浏览代码

Review revision for windows path separator detection in mg_upload

Katerina Blinova 12 年之前
父节点
当前提交
dfb7d928c2
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      mongoose.c

+ 2 - 3
mongoose.c

@@ -4226,10 +4226,9 @@ int mg_upload(struct mg_connection *conn, const char *destination_dir) {
     // there is no other thread can save into the same file simultaneously.
     fp = NULL;
     // Construct destination file name. Do not allow paths to have slashes.
-    if ((s = strrchr(fname, '/')) == NULL) {
-        if ((s = strrchr(fname, '\\')) == NULL) {
+    if ((s = strrchr(fname, '/')) == NULL && 
+		(s = strrchr(fname, '\\')) == NULL) {
             s = fname;
-        }
     }
     
     // Open file in binary mode. TODO: set an exclusive lock.