diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-06-25 13:00:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-06-25 13:00:17 +0000 |
commit | 2c646f956fe2fbd926a1413ed4e3db5abf4dc51e (patch) | |
tree | 15d17c1af7a340f347600c0d903c5eea04677d0d /doc/examples | |
parent | 7c78413efaf3000f09568a4b22be2cb585424609 (diff) | |
download | libmicrohttpd-2c646f956fe2fbd926a1413ed4e3db5abf4dc51e.tar.gz libmicrohttpd-2c646f956fe2fbd926a1413ed4e3db5abf4dc51e.zip |
-nicer error handling in example
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/sessions.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c index 870f9249..2c0176ea 100644 --- a/doc/examples/sessions.c +++ b/doc/examples/sessions.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <microhttpd.h> | 12 | #include <microhttpd.h> |
13 | 13 | ||
14 | #ifdef _WIN32 | 14 | #ifdef _WIN32 |
15 | int | 15 | static int |
16 | asprintf (char **resultp, const char *format, ...) | 16 | asprintf (char **resultp, const char *format, ...) |
17 | { | 17 | { |
18 | va_list argptr; | 18 | va_list argptr; |
@@ -758,7 +758,14 @@ main (int argc, char *const *argv) | |||
758 | } | 758 | } |
759 | else | 759 | else |
760 | tvp = NULL; | 760 | tvp = NULL; |
761 | select (max + 1, &rs, &ws, &es, tvp); | 761 | if (-1 == select (max + 1, &rs, &ws, &es, tvp)) |
762 | { | ||
763 | if (EINTR != errno) | ||
764 | fprintf (stderr, | ||
765 | "Aborting due to error during select: %s\n", | ||
766 | strerror (errno)); | ||
767 | break; | ||
768 | } | ||
762 | MHD_run (d); | 769 | MHD_run (d); |
763 | } | 770 | } |
764 | MHD_stop_daemon (d); | 771 | MHD_stop_daemon (d); |