mirror of
https://github.com/Ascend/ascend-docker-runtime.git
synced 2025-10-13 10:43:53 +08:00
Match-id-72be8dc15a12025cd504eb630821c23a35e341be
This commit is contained in:
@@ -132,9 +132,15 @@ static int Mount(const char *src, const char *dst)
|
|||||||
|
|
||||||
static int CreateFile(const char *path, mode_t mode)
|
static int CreateFile(const char *path, mode_t mode)
|
||||||
{
|
{
|
||||||
int fd = open(path, O_NOFOLLOW | O_CREAT, mode);
|
char resolvedPath[PATH_MAX] = {0};
|
||||||
|
if (realpath(path, resolvedPath) == NULL && errno != ENOENT) {
|
||||||
|
fprintf(stderr, "error: failed to resolve path %s\n", path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fd = open(resolvedPath, O_NOFOLLOW | O_CREAT, mode);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "error: cannot create file: %s\n", path);
|
fprintf(stderr, "error: cannot create file: %s\n", resolvedPath);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Reference in New Issue
Block a user