nspawn: fix copy/reflink fallback when directory already exists (#8781)
authorMilan <me@petabyteboy.de>
Tue, 24 Apr 2018 09:38:08 +0000 (11:38 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 24 Apr 2018 09:38:08 +0000 (11:38 +0200)
src/basic/btrfs-util.c

index 77e9d90..7720d98 100644 (file)
@@ -1690,7 +1690,7 @@ int btrfs_subvol_snapshot_fd(int old_fd, const char *new_path, BtrfsSnapshotFlag
                 if (r == -ENOTTY && (flags & BTRFS_SNAPSHOT_FALLBACK_DIRECTORY)) {
                         /* If the destination doesn't support subvolumes, then use a plain directory, if that's requested. */
                         if (mkdir(new_path, 0755) < 0)
-                                return r;
+                                return -errno;
 
                         plain_directory = true;
                 } else if (r < 0)