diff options
| author | norrarvid <norrarvid@gmail.com> | 2012-05-29 13:24:23 +0200 |
|---|---|---|
| committer | norrarvid <norrarvid@gmail.com> | 2012-05-29 13:24:23 +0200 |
| commit | 2109d7a044430ee4ad5b51f2c18cc496be0e7fd8 (patch) | |
| tree | 17d9b9852a05fe9f9a67540670bef1b3c3d14b69 /common/os_calls.c | |
| parent | 60b052965634be151d88f7011149d0edc71f23d8 (diff) | |
| parent | a45f993bfe74aed27245454f1ae32302b0528d9f (diff) | |
| download | xrdp-proprietary-2109d7a044430ee4ad5b51f2c18cc496be0e7fd8.tar.gz xrdp-proprietary-2109d7a044430ee4ad5b51f2c18cc496be0e7fd8.zip | |
merge comments defines and simplified function
Diffstat (limited to 'common/os_calls.c')
| -rw-r--r-- | common/os_calls.c | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index 211adc82..80e5bad3 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -1069,28 +1069,39 @@ g_obj_wait(tbus* read_objs, int rcount, tbus* write_objs, int wcount, ptime = &time; } FD_ZERO(&rfds); - FD_ZERO(&wfds); - for (i = 0; i < rcount; i++) - { - sck = (int)(read_objs[i]); - if (sck > 0) { - FD_SET(sck, &rfds); - if (sck > max) - { - max = sck; + FD_ZERO(&wfds); + /*Find the highest descriptor number in read_obj */ + if(read_objs!=NULL){ + for (i = 0; i < rcount; i++) + { + sck = (int)(read_objs[i]); + if (sck > 0) { + FD_SET(sck, &rfds); + if (sck > max) + { + max = sck; /*max holds the highest socket/descriptor number */ + } } } + }else if(rcount>0){ + g_writeln("Programming error read_objs is null"); + return 1; /*error*/ } - for (i = 0; i < wcount; i++) - { - sck = (int)(write_objs[i]); - if (sck > 0) { - FD_SET(sck, &wfds); - if (sck > max) - { - max = sck; + if(write_objs!=NULL){ + for (i = 0; i < wcount; i++) + { + sck = (int)(write_objs[i]); + if (sck > 0) { + FD_SET(sck, &wfds); + if (sck > max) + { + max = sck; /*max holds the highest socket/descriptor number */ + } } } + }else if(wcount>0){ + g_writeln("Programming error write_objs is null"); + return 1; /*error*/ } res = select(max + 1, &rfds, &wfds, 0, ptime); if (res < 0) @@ -1103,7 +1114,7 @@ g_obj_wait(tbus* read_objs, int rcount, tbus* write_objs, int wcount, { return 0; } - return 1; + return 1; /*error*/ } return 0; #endif |
