summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Lass <bevan@bi-co.net>2015-11-08 16:33:03 +0100
committerDavid Sterba <dsterba@suse.com>2015-11-16 14:23:44 +0100
commit28f9f620f3473389cdba80ae606bf064e5b16628 (patch)
treeb2464640f9dfb60381ac9a9a91435eb36c5c071f
parent87ab14013a38a93930dd47a16eec68930ec8f320 (diff)
btrfs-progs: mkfs: increase buffer size in is_ssd
In current versions of util-linux the buffer passed to blkid_devno_to_wholedisk has to be sufficiently large to not only hold the device name but the complete target of the /sys/dev/block/<maj:min> symlink. This was changed only recently in 4419ffb9eff5801fdbd385a4a6199b3877f802ad. The small buffer size currently can lead to failure of is_ssd due to truncated device names: readlink("/sys/dev/block/254:7", "../../devices/virtual/block/dm-", 31) = 31 open("/sys/block/dm-/queue/rotational", O_RDONLY) = -1 ENOENT (No such file or directory) Signed-off-by: Michael Lass <bevan@bi-co.net> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--mkfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mkfs.c b/mkfs.c
index 1e0d0a89..5f1411f1 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1111,7 +1111,7 @@ static int zero_output_file(int out_fd, u64 size)
static int is_ssd(const char *file)
{
blkid_probe probe;
- char wholedisk[32];
+ char wholedisk[PATH_MAX];
char sysfs_path[PATH_MAX];
dev_t devno;
int fd;