mirror of
https://github.com/Ascend/ascend-docker-runtime.git
synced 2025-10-29 04:02:37 +08:00
Match-id-c6cbeee5e47608c24c4301878b5f1acceddee981
This commit is contained in:
@@ -128,25 +128,19 @@ int MakeMountPoints(const char *path, mode_t mode)
|
||||
|
||||
int ret = MakeDirWithParent(parentDir, DEFAULT_DIR_MODE);
|
||||
if (ret < 0) {
|
||||
char* str = FormatLogMessage("failed to make parent dir for file: %s", path);
|
||||
Logger(str, LEVEL_ERROR, SCREEN_YES);
|
||||
free(str);
|
||||
Logger("Failed to make parent dir for file.", LEVEL_ERROR, SCREEN_YES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
char resolvedPath[PATH_MAX] = {0};
|
||||
if (realpath(path, resolvedPath) == NULL && errno != ENOENT) {
|
||||
char* str = FormatLogMessage("failed to resolve path %s.", path);
|
||||
Logger(str, LEVEL_ERROR, SCREEN_YES);
|
||||
free(str);
|
||||
Logger("failed to resolve path.", LEVEL_ERROR, SCREEN_YES);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fd = open(resolvedPath, O_NOFOLLOW | O_CREAT, mode);
|
||||
if (fd < 0) {
|
||||
char* str = FormatLogMessage("cannot create file: %s.", resolvedPath);
|
||||
Logger(str, LEVEL_ERROR, SCREEN_YES);
|
||||
free(str);
|
||||
Logger("cannot create file.", LEVEL_ERROR, SCREEN_YES);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
@@ -174,6 +168,6 @@ int CheckLegality(const char* filename)
|
||||
return -1;
|
||||
}
|
||||
} while (strcmp(dirname(buf), "/"));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user