浏览代码

deploy-ng: fix crash when using local logfile in non-writable dir

Fixes #462
rdb 7 年之前
父节点
当前提交
3124564040
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      pandatool/src/deploy-stub/deploy-stub.c

+ 4 - 4
pandatool/src/deploy-stub/deploy-stub.c

@@ -141,8 +141,8 @@ static int mkdir_parent(const wchar_t *path) {
       break;
     }
   }
-  if (buflen == 0) {
-    // There was no path separator.
+  if (buflen == (size_t)-1 || buflen == 0) {
+    // There was no path separator, or this was the root directory.
     return 0;
   }
 
@@ -187,8 +187,8 @@ static int mkdir_parent(const char *path) {
       break;
     }
   }
-  if (buflen == 0) {
-    // There was no path separator.
+  if (buflen == (size_t)-1 || buflen == 0) {
+    // There was no path separator, or this was the root directory.
     return 0;
   }
   if (mkdir(buffer, 0755) == 0) {