diff options
author | Daniel Mack <github@zonque.org> | 2016-01-27 13:35:18 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2016-01-27 13:35:18 +0100 |
commit | fdb4ee00f022863ceee923b196f9c6dd536db9e2 (patch) | |
tree | 647aae3aa21c2e22073fc895f39a2c171e052a99 /src/basic/btrfs-util.c | |
parent | 1cdc94482302cca88e0a7282bbc161c1d77c381c (diff) | |
parent | a464cf80110f0c7424f688ffaa4ec0a8a19f9720 (diff) |
Merge pull request #2445 from poettering/various-fixes
A number of fixes
Diffstat (limited to 'src/basic/btrfs-util.c')
-rw-r--r-- | src/basic/btrfs-util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/basic/btrfs-util.c b/src/basic/btrfs-util.c index d07d1df5a8..03c7609c92 100644 --- a/src/basic/btrfs-util.c +++ b/src/basic/btrfs-util.c @@ -43,6 +43,7 @@ #include "copy.h" #include "fd-util.h" #include "fileio.h" +#include "io-util.h" #include "macro.h" #include "missing.h" #include "path-util.h" @@ -913,6 +914,10 @@ int btrfs_resize_loopback_fd(int fd, uint64_t new_size, bool grow_only) { dev_t dev = 0; int r; + /* In contrast to btrfs quota ioctls ftruncate() cannot make sense of "infinity" or file sizes > 2^31 */ + if (!FILE_SIZE_VALID(new_size)) + return -EINVAL; + /* btrfs cannot handle file systems < 16M, hence use this as minimum */ if (new_size < 16*1024*1024) new_size = 16*1024*1024; |