coverity: fixed issue argument cannot be negative

ulab-next-nosound
Laxmikant Rashinkar 10 years ago
parent 0c63a8feb3
commit fde7be5151

@ -118,7 +118,7 @@ dev_redir_init(void)
} u; } u;
/* get a random number that will act as a unique clientID */ /* get a random number that will act as a unique clientID */
if ((fd = open("/dev/urandom", O_RDONLY))) if ((fd = open("/dev/urandom", O_RDONLY)) != -1)
{ {
if (read(fd, u.buf, 4) != 4) if (read(fd, u.buf, 4) != 4)
{ {

@ -58,7 +58,12 @@ int main(int argc, char **argv)
return 1; return 1;
} }
sck = socket(PF_UNIX, SOCK_DGRAM, 0); if ((sck = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0)
{
printf("socket open error\n");
return 1;
}
len = sizeof(sa); len = sizeof(sa);
if (sendto(sck, "sig", 4, 0, (struct sockaddr *)&sa, len) > 0) if (sendto(sck, "sig", 4, 0, (struct sockaddr *)&sa, len) > 0)

@ -124,7 +124,11 @@ WTSVirtualChannelOpenEx(unsigned int SessionId, const char *pVirtualName,
} }
/* we use unix domain socket to communicate with chansrv */ /* we use unix domain socket to communicate with chansrv */
wts->fd = socket(AF_UNIX, SOCK_STREAM, 0); if ((wts->fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
{
g_free(wts);
return NULL;
}
/* set non blocking */ /* set non blocking */
llong = fcntl(wts->fd, F_GETFL); llong = fcntl(wts->fd, F_GETFL);

Loading…
Cancel
Save