浏览代码

Do not report error if mg_printf() printed 0 bytes

Sergey Lyubka 13 年之前
父节点
当前提交
8072b0a7d4
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      mongoose.c

+ 3 - 1
mongoose.c

@@ -1492,7 +1492,9 @@ int mg_printf(struct mg_connection *conn, const char *fmt, ...) {
   len = vsnprintf(mem, sizeof(mem), fmt, ap);
   va_end(ap);
 
-  if (len <= 0) {
+  if (len == 0) {
+    // Do nothing. mg_printf(conn, "%s", "") was called.
+  } else if (len < 0) {
     // vsnprintf() error, give up
     len = -1;
     cry(conn, "%s(%s, ...): vsnprintf() error", __func__, fmt);