mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
machinectl: make sure of path_extract_filename() returning O_DIRECTORY
This commit is contained in:
parent
ee277c6bc7
commit
7fc607637f
@ -1872,6 +1872,9 @@ static int import_tar(int argc, char *argv[], void *userdata) {
|
||||
r = path_extract_filename(path, &fn);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Cannot extract container name from filename: %m");
|
||||
if (r == O_DIRECTORY)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EISDIR),
|
||||
"Path '%s' refers to directory, but we need a regular file: %m", path);
|
||||
|
||||
local = fn;
|
||||
}
|
||||
@ -1932,6 +1935,9 @@ static int import_raw(int argc, char *argv[], void *userdata) {
|
||||
r = path_extract_filename(path, &fn);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Cannot extract container name from filename: %m");
|
||||
if (r == O_DIRECTORY)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EISDIR),
|
||||
"Path '%s' refers to directory, but we need a regular file: %m", path);
|
||||
|
||||
local = fn;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user