diff options
author | Hans de Goede <hdegoede@redhat.com> | 2013-05-13 09:59:32 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-05-13 09:59:32 +0200 |
commit | 65b99a49dc4d5d4cf16ba880d3377196e96f1bc5 (patch) | |
tree | 3f1d2d3e8672a07a4f54e258739c60527febf386 /usbredirtestclient | |
parent | c7e8bfe7f88ea11b31ebe115a629fb1cc903f7bc (diff) |
usbredirserver/testclient: Error check fcntl calls
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'usbredirtestclient')
-rw-r--r-- | usbredirtestclient/usbredirtestclient.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usbredirtestclient/usbredirtestclient.c b/usbredirtestclient/usbredirtestclient.c index a9123da..42b16dc 100644 --- a/usbredirtestclient/usbredirtestclient.c +++ b/usbredirtestclient/usbredirtestclient.c @@ -189,7 +189,7 @@ static void quit_handler(int sig) int main(int argc, char *argv[]) { - int o; + int o, flags; char *endptr, *server; struct addrinfo *r, *res, hints; struct sigaction act; @@ -265,7 +265,17 @@ int main(int argc, char *argv[]) exit(1); } - fcntl(client_fd, F_SETFL, (long)fcntl(client_fd, F_GETFL) | O_NONBLOCK); + flags = fcntl(client_fd, F_GETFL); + if (flags == -1) { + perror("fcntl F_GETFL"); + exit(1); + } + flags = fcntl(client_fd, F_SETFL, flags | O_NONBLOCK); + if (flags == -1) { + perror("fcntl F_SETFL O_NONBLOCK"); + exit(1); + } + parser = usbredirparser_create(); if (!parser) { exit(1); |