summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/os_calls.c36
-rw-r--r--sesman/chansrv/clipboard_file.c8
-rw-r--r--sesman/env.c6
-rw-r--r--sesman/sesman.c14
-rw-r--r--xrdp/xrdp.c16
-rw-r--r--xrdp/xrdp_bitmap.c26
-rw-r--r--xrdpapi/xrdpapi.c5
7 files changed, 88 insertions, 23 deletions
diff --git a/common/os_calls.c b/common/os_calls.c
index 1d3a71b1..68a6a5b0 100644
--- a/common/os_calls.c
+++ b/common/os_calls.c
@@ -471,8 +471,11 @@ g_tcp_socket(void)
{
option_value = 0;
option_len = sizeof(option_value);
- setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
- option_len);
+ if (setsockopt(rv, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&option_value,
+ option_len) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
+ }
}
}
#endif
@@ -484,8 +487,11 @@ g_tcp_socket(void)
{
option_value = 1;
option_len = sizeof(option_value);
- setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
- option_len);
+ if (setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (char *)&option_value,
+ option_len) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
+ }
}
}
@@ -498,8 +504,11 @@ g_tcp_socket(void)
{
option_value = 1024 * 32;
option_len = sizeof(option_value);
- setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
- option_len);
+ if (setsockopt(rv, SOL_SOCKET, SO_SNDBUF, (char *)&option_value,
+ option_len) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "g_tcp_socket: setsockopt() failed\n");
+ }
}
}
@@ -785,7 +794,10 @@ g_tcp_set_non_blocking(int sck)
#else
i = fcntl(sck, F_GETFL);
i = i | O_NONBLOCK;
- fcntl(sck, F_SETFL, i);
+ if (fcntl(sck, F_SETFL, i) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "g_tcp_set_non_blocking: fcntl() failed\n");
+ }
#endif
return 0;
}
@@ -1421,7 +1433,12 @@ g_set_wait_obj(tbus obj)
return 1;
}
- sendto(s, "sig", 4, 0, (struct sockaddr *)&sa, sa_size);
+ if (sendto(s, "sig", 4, 0, (struct sockaddr *)&sa, sa_size) < 0)
+ {
+ close(s);
+ return 1;
+ }
+
close(s);
return 0;
#endif
@@ -1934,8 +1951,7 @@ g_mkdir(const char *dirname)
#if defined(_WIN32)
return 0;
#else
- mkdir(dirname, S_IRWXU);
- return 0;
+ return mkdir(dirname, S_IRWXU);
#endif
}
diff --git a/sesman/chansrv/clipboard_file.c b/sesman/chansrv/clipboard_file.c
index 96f1b0e8..ff95b0a0 100644
--- a/sesman/chansrv/clipboard_file.c
+++ b/sesman/chansrv/clipboard_file.c
@@ -446,7 +446,13 @@ clipboard_send_file_data(int streamId, int lindex,
full_fn);
return 1;
}
- g_file_seek(fd, nPositionLow);
+ if (g_file_seek(fd, nPositionLow) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "clipboard_send_file_data: seek error "
+ "in file: %s\n", full_fn);
+ g_file_close(fd);
+ return 1;
+ }
make_stream(s);
init_stream(s, cbRequested + 64);
size = g_file_read(fd, s->data + 12, cbRequested);
diff --git a/sesman/env.c b/sesman/env.c
index 26d1a4f7..227f6bbf 100644
--- a/sesman/env.c
+++ b/sesman/env.c
@@ -129,7 +129,11 @@ env_set_user(char *username, char *passwd_file, int display,
{
/* if no auth_file_path is set, then we go for
$HOME/.vnc/sesman_username_passwd */
- g_mkdir(".vnc");
+ if (g_mkdir(".vnc") < 0)
+ {
+ log_message(LOG_LEVEL_ERROR,
+ "env_set_user: error creating .vnc dir");
+ }
g_sprintf(passwd_file, "%s/.vnc/sesman_%s_passwd", pw_dir, username);
}
else
diff --git a/sesman/sesman.c b/sesman/sesman.c
index db755a65..964bc740 100644
--- a/sesman/sesman.c
+++ b/sesman/sesman.c
@@ -308,9 +308,17 @@ main(int argc, char **argv)
g_file_close(1);
g_file_close(2);
- g_file_open("/dev/null");
- g_file_open("/dev/null");
- g_file_open("/dev/null");
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
+
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
+
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
}
/* initializing locks */
diff --git a/xrdp/xrdp.c b/xrdp/xrdp.c
index ba9d02a3..02e94d41 100644
--- a/xrdp/xrdp.c
+++ b/xrdp/xrdp.c
@@ -538,9 +538,19 @@ main(int argc, char **argv)
g_file_close(0);
g_file_close(1);
g_file_close(2);
- g_file_open("/dev/null");
- g_file_open("/dev/null");
- g_file_open("/dev/null");
+
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
+
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
+
+ if (g_file_open("/dev/null") < 0)
+ {
+ }
+
/* end of daemonizing code */
}
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index 87fb0ebc..6438f0e7 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -441,7 +441,13 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette)
g_file_read(fd, s->data, 4);
in_uint32_le(s, size);
/* read bmp header */
- g_file_seek(fd, 14);
+ if (g_file_seek(fd, 14) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n",
+ filename);
+ g_file_close(fd);
+ return 1;
+ }
init_stream(s, 8192);
g_file_read(fd, s->data, 40); /* size better be 40 */
in_uint32_le(s, header.size);
@@ -468,7 +474,11 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette)
if (header.bit_count == 24) /* 24 bit bitmap */
{
- g_file_seek(fd, 14 + header.size);
+ if (g_file_seek(fd, 14 + header.size) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n",
+ filename);
+ }
xrdp_bitmap_resize(self, header.image_width, header.image_height);
size = header.image_width * header.image_height * 3;
init_stream(s, size);
@@ -521,7 +531,11 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette)
else if (header.bit_count == 8) /* 8 bit bitmap */
{
/* read palette */
- g_file_seek(fd, 14 + header.size);
+ if (g_file_seek(fd, 14 + header.size) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n",
+ filename);
+ }
init_stream(s, 8192);
g_file_read(fd, s->data, header.clr_used * sizeof(int));
@@ -578,7 +592,11 @@ xrdp_bitmap_load(struct xrdp_bitmap *self, const char *filename, int *palette)
else if (header.bit_count == 4) /* 4 bit bitmap */
{
/* read palette */
- g_file_seek(fd, 14 + header.size);
+ if (g_file_seek(fd, 14 + header.size) < 0)
+ {
+ log_message(LOG_LEVEL_ERROR, "xrdp_bitmap_load: seek error in file %s\n",
+ filename);
+ }
init_stream(s, 8192);
g_file_read(fd, s->data, header.clr_used * sizeof(int));
diff --git a/xrdpapi/xrdpapi.c b/xrdpapi/xrdpapi.c
index 4cf8db71..23630804 100644
--- a/xrdpapi/xrdpapi.c
+++ b/xrdpapi/xrdpapi.c
@@ -129,7 +129,10 @@ WTSVirtualChannelOpenEx(unsigned int SessionId, const char *pVirtualName,
/* set non blocking */
llong = fcntl(wts->fd, F_GETFL);
llong = llong | O_NONBLOCK;
- fcntl(wts->fd, F_SETFL, llong);
+ if (fcntl(wts->fd, F_SETFL, llong) < 0)
+ {
+ LLOGLN(10, ("WTSVirtualChannelOpenEx: set non-block mode failed"));
+ }
/* connect to chansrv session */
memset(&s, 0, sizeof(struct sockaddr_un));