瀏覽代碼

_starpu_mkpath: Ignore duplicate leading slashes in path

Otherwise _starpu_mkpath("//") would just call itself indefinitely.
Samuel Thibault 5 年之前
父節點
當前提交
6a4f79381a
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/common/utils.c

+ 4 - 1
src/common/utils.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2017,2019                           Université de Bordeaux
+ * Copyright (C) 2010-2017,2019-2020                      Université de Bordeaux
  * Copyright (C) 2012,2016,2017                           Inria
  * Copyright (C) 2010-2017, 2019                          CNRS
  *
@@ -81,6 +81,9 @@ int _starpu_mkpath(const char *s, mode_t mode)
 	char *q, *r = NULL, *path = NULL, *up = NULL;
 	int rv = -1;
 
+	while (s[0] == '/' && s[1] == '/')
+		s++;
+
 	if (strcmp(s, ".") == 0 || strcmp(s, "/") == 0
 #if defined(_WIN32)
 		/* C:/ or C:\ */