Skip to content

Commit 0e66228

Browse files
kilobytekdave
authored andcommitted
btrfs-progs: subvol delete: hide a warning on an unprivileged delete
Checking the default subvolume uses TREE_SEARCH which is a CAP_SYS_ADMIN only operation, and thus will fail when unprivileged, even if we have permissions to actually delete the subvolume. This produces a warning even if all is ok. Let's hide it if we're not root (root but !CAP is odd enough to warn). Fixes 87804a3 ("btrfs-progs: subvolume: check deleting default subvolume") Link: https://bugs.debian.org/998840 Signed-off-by: Adam Borowski <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent f77da2b commit 0e66228

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmds/subvolume.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ static int cmd_subvol_delete(const struct cmd_struct *cmd,
376376

377377
err = btrfs_util_get_default_subvolume_fd(fd, &default_subvol_id);
378378
if (err) {
379-
warning("cannot read default subvolume id: %m");
379+
if (geteuid() != 0)
380+
warning("cannot read default subvolume id: %m");
380381
default_subvol_id = 0;
381382
}
382383

0 commit comments

Comments
 (0)