]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/journal-remote/microhttpd-util.c
journal-remote: implement %m support in mhd_respondf
[thirdparty/systemd.git] / src / journal-remote / microhttpd-util.c
index 2f16b02e9a98f663832da93b12058d5b29cf41e3..67d97e24ff1aa34c19ba1d1071d388c3738ccecf 100644 (file)
@@ -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);