summaryrefslogtreecommitdiff
path: root/src/journal-remote/microhttpd-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-12 19:24:45 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-09-13 20:10:56 -0400
commit1b4cd64683ba057cb3d4c5cd311b1c25e6d8d614 (patch)
tree9e1a26a53b7a02f5449013cbd6d7101eb1c8ecc3 /src/journal-remote/microhttpd-util.c
parent303a2ebcb600e475fd8b87caef81cf3790f0fa81 (diff)
journal-remote: implement %m support in mhd_respondf
errno value is not protected (it is undefined after this function returns). Various mhd_* functions are not documented to protect errno, so this could not guaranteed anyway.
Diffstat (limited to 'src/journal-remote/microhttpd-util.c')
-rw-r--r--src/journal-remote/microhttpd-util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
index 2f16b02e9a..67d97e24ff 100644
--- a/src/journal-remote/microhttpd-util.c
+++ b/src/journal-remote/microhttpd-util.c
@@ -82,6 +82,7 @@ int mhd_respond_oom(struct MHD_Connection *connection) {
}
int mhd_respondf(struct MHD_Connection *connection,
+ int error,
enum MHD_RequestTerminationCode code,
const char *format, ...) {
@@ -92,6 +93,9 @@ int mhd_respondf(struct MHD_Connection *connection,
assert(connection);
assert(format);
+ if (error < 0)
+ error = -error;
+ errno = -error;
va_start(ap, format);
r = vasprintf(&m, format, ap);
va_end(ap);