浏览代码

Merge pull request #203 from LawrenceChan/master

Fixed mg_upload() to work with multiple files.
bel2125 9 年之前
父节点
当前提交
72aec8838c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/civetweb.c

+ 3 - 1
src/civetweb.c

@@ -8406,7 +8406,9 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir)
 				memmove(buf, &buf[len - bl], (size_t)bl);
 				len = bl;
 			}
-			n = mg_read(conn, buf + len, sizeof(buf) - ((size_t)(len)));
+			if (!eof) {
+				n = mg_read(conn, buf + len, sizeof(buf) - ((size_t)(len)));
+			}
 		} while (!eof && (n > 0));
 		fclose(fp);
 		if (eof) {