diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-10 16:40:27 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-10 16:40:27 +0100 |
commit | 91548850d961783a8f5b288c69ce83ecb89d3ddc (patch) | |
tree | 90d9bf46480d2275aeed5e339e3c81c3bf278e99 /src/examples | |
parent | 2123decd504e9fe024db7efba6d199b3457c7ad9 (diff) | |
download | libmicrohttpd-91548850d961783a8f5b288c69ce83ecb89d3ddc.tar.gz libmicrohttpd-91548850d961783a8f5b288c69ce83ecb89d3ddc.zip |
check system call return values in tests
Diffstat (limited to 'src/examples')
-rw-r--r-- | src/examples/fileserver_example.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/examples/fileserver_example.c b/src/examples/fileserver_example.c index 4d710575..692e1f34 100644 --- a/src/examples/fileserver_example.c +++ b/src/examples/fileserver_example.c | |||
@@ -79,7 +79,8 @@ ahc_echo (void *cls, | |||
79 | (! S_ISREG (buf.st_mode)) ) | 79 | (! S_ISREG (buf.st_mode)) ) |
80 | { | 80 | { |
81 | /* not a regular file, refuse to serve */ | 81 | /* not a regular file, refuse to serve */ |
82 | close (fd); | 82 | if (0 != close (fd)) |
83 | abort (); | ||
83 | fd = -1; | 84 | fd = -1; |
84 | } | 85 | } |
85 | } | 86 | } |
@@ -93,10 +94,11 @@ ahc_echo (void *cls, | |||
93 | } | 94 | } |
94 | else | 95 | else |
95 | { | 96 | { |
96 | response = MHD_create_response_from_fd64(buf.st_size, fd); | 97 | response = MHD_create_response_from_fd64 (buf.st_size, fd); |
97 | if (NULL == response) | 98 | if (NULL == response) |
98 | { | 99 | { |
99 | close (fd); | 100 | if (0 != close (fd)) |
101 | abort (); | ||
100 | return MHD_NO; | 102 | return MHD_NO; |
101 | } | 103 | } |
102 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); | 104 | ret = MHD_queue_response (connection, MHD_HTTP_OK, response); |