summaryrefslogtreecommitdiff
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-13 18:04:22 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-14 11:07:09 +0100
commit5b56fe9db5cc69d9ce2c125ab86c6546ae4e7323 (patch)
treec1d87741bbeb099f762e8e2053735de55b8369d5 /cmds-subvolume.c
parent1267c58e58429647454ccd5a41ffdee07ba0dfdc (diff)
btrfs-progs: handle errors from test_isdir
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-subvolume.c')
-rw-r--r--cmds-subvolume.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 26af0a7..6ff41e2 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -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;