mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-10 04:54:24 +08:00
btrfs-progs: handle errors from test_isdir
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
1267c58e58
commit
5b56fe9db5
@ -158,6 +158,10 @@ static int cmd_subvol_create(int argc, char **argv)
|
||||
|
||||
retval = 1; /* failure */
|
||||
res = test_isdir(dst);
|
||||
if (res < 0 && res != -ENOENT) {
|
||||
error("cannot access %s: %s", dst, strerror(-res));
|
||||
goto out;
|
||||
}
|
||||
if (res >= 0) {
|
||||
error("target path already exists: %s", dst);
|
||||
goto out;
|
||||
@ -684,6 +688,10 @@ static int cmd_subvol_snapshot(int argc, char **argv)
|
||||
}
|
||||
|
||||
res = test_isdir(dst);
|
||||
if (res < 0 && res != -ENOENT) {
|
||||
error("cannot access %s: %s", dst, strerror(-res));
|
||||
goto out;
|
||||
}
|
||||
if (res == 0) {
|
||||
error("'%s' exists and it is not a directory", dst);
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user