commit 2c646f956fe2fbd926a1413ed4e3db5abf4dc51e
parent 7c78413efaf3000f09568a4b22be2cb585424609
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 25 Jun 2013 13:00:17 +0000
-nicer error handling in example
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
@@ -12,7 +12,7 @@
#include <microhttpd.h>
#ifdef _WIN32
-int
+static int
asprintf (char **resultp, const char *format, ...)
{
va_list argptr;
@@ -758,7 +758,14 @@ main (int argc, char *const *argv)
}
else
tvp = NULL;
- select (max + 1, &rs, &ws, &es, tvp);
+ if (-1 == select (max + 1, &rs, &ws, &es, tvp))
+ {
+ if (EINTR != errno)
+ fprintf (stderr,
+ "Aborting due to error during select: %s\n",
+ strerror (errno));
+ break;
+ }
MHD_run (d);
}
MHD_stop_daemon (d);