static NORETURN void die_webcgi(const char *err, va_list params)
{
- http_status(500, "Internal Server Error");
- hdr_nocache();
- end_headers();
+ static int dead;
- vreportf("fatal: ", err, params);
- exit(0);
+ if (!dead) {
- char buffer[1000];
+ dead = 1;
-
- vsnprintf(buffer, sizeof(buffer), err, params);
- fprintf(stderr, "fatal: %s\n", buffer);
+ http_status(500, "Internal Server Error");
+ hdr_nocache();
+ end_headers();
++
++ vreportf("fatal: ", err, params);
+ }
+ exit(0); /* we successfully reported a failure ;-) */
}
static char* getdir(void)
if (len > sizeof(msg))
len = sizeof(msg);
- write(child_err, "fatal: ", 7);
- write(child_err, msg, len);
- write(child_err, "\n", 1);
+ unused = write(child_err, "fatal: ", 7);
+ unused = write(child_err, msg, len);
+ unused = write(child_err, "\n", 1);
exit(128);
}
+ #endif
static inline void set_cloexec(int fd)
{