mirror of https://github.com/neutrinolabs/xrdp
coverity: fixed unchecked return value from library
This commit is contained in:
parent
023c0b5bc1
commit
a990287c46
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
16
xrdp/xrdp.c
16
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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue