fix net_printf not working with empty strings webdav

Fri, 09 Sep 2022 20:17:23 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 09 Sep 2022 20:17:23 +0200
branch
webdav
changeset 383
a5698877d14a
parent 382
9e2289c77b04
child 384
f9e9f2b3e299

fix net_printf not working with empty strings

src/server/util/io.c file | annotate | diff | comparison | revisions
--- a/src/server/util/io.c	Thu Sep 08 17:34:16 2022 +0200
+++ b/src/server/util/io.c	Fri Sep 09 20:17:23 2022 +0200
@@ -735,7 +735,7 @@
     va_list arg;
     va_start(arg, format);
     sstr_t buf = ucx_vasprintf(ucx_default_allocator(), format, arg);
-    ssize_t r = net_write(fd, buf.ptr, buf.length);
+    ssize_t r = buf.length > 0 ? net_write(fd, buf.ptr, buf.length) : 0;
     free(buf.ptr);
     va_end(arg);
     if(r < 0) {

mercurial