Skip to content

Commit

Permalink
btrfs-progs: receive: make receive fall back on EPERM
Browse files Browse the repository at this point in the history
For non-root usage, receive can't write compressed data and will get
EPERM, but falling back to writing uncompressed data may work and allows
receive as a normal user, which is safer.

Signed-off-by: Sweet Tea Dorminy <[email protected]>
  • Loading branch information
sweettea committed Mar 21, 2024
1 parent 682f676 commit ea2c8e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmds/receive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ static int process_encoded_write(const char *path, const void *data, u64 offset,
if (ret >= 0)
return 0;
/* Fall back for these errors, fail hard for anything else. */
if (errno != ENOSPC && errno != ENOTTY && errno != EINVAL) {
if (errno != ENOSPC && errno != ENOTTY && errno != EINVAL && errno != EPERM) {
ret = -errno;
error("encoded_write: writing to %s failed: %m", path);
return ret;
Expand Down

0 comments on commit ea2c8e6

Please sign in to comment.