summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-06-11 00:51:15 +0200
committerDavid Sterba <dsterba@suse.cz>2015-06-11 00:51:15 +0200
commit4ceffd0927360c83bec94606112b4e59cb7d2d73 (patch)
treee68e184aeca6626d4e1ed78c6ba79e1fb33a0956 /utils.c
parentc848046eb984fcbeeb78d681bf483aefbb35a013 (diff)
downloadbtrfs-progs-4ceffd0927360c83bec94606112b4e59cb7d2d73.tar.gz
btrfs-progs: print error within test_num_disk_vs_raid
The error string buffer passed as an argument is of a fixed size, though we could print up to PATH_MAX + something bytes. Print the error message directly. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/utils.c b/utils.c
index 36aba39..b498381 100644
--- a/utils.c
+++ b/utils.c
@@ -2329,9 +2329,8 @@ static int group_profile_devs_min(u64 flag)
}
int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
- u64 dev_cnt, int mixed, char *estr)
+ u64 dev_cnt, int mixed)
{
- size_t sz = 100;
u64 allowed = 0;
switch (dev_cnt) {
@@ -2350,21 +2349,21 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
if (dev_cnt > 1 &&
((metadata_profile | data_profile) & BTRFS_BLOCK_GROUP_DUP)) {
- snprintf(estr, sz,
- "DUP is not allowed when FS has multiple devices\n");
+ fprintf(stderr,
+ "ERROR: DUP is not allowed when FS has multiple devices\n");
return 1;
}
if (metadata_profile & ~allowed) {
- snprintf(estr, sz,
- "unable to create FS with metadata profile %s "
+ fprintf(stderr,
+ "ERROR: unable to create FS with metadata profile %s "
"(have %llu devices but %d devices are required)\n",
btrfs_group_profile_str(metadata_profile), dev_cnt,
group_profile_devs_min(metadata_profile));
return 1;
}
if (data_profile & ~allowed) {
- snprintf(estr, sz,
- "unable to create FS with data profile %s "
+ fprintf(stderr,
+ "ERROR: unable to create FS with data profile %s "
"(have %llu devices but %d devices are required)\n",
btrfs_group_profile_str(data_profile), dev_cnt,
group_profile_devs_min(data_profile));
@@ -2372,8 +2371,8 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile,
}
if (!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP)) {
- snprintf(estr, sz,
- "dup for data is allowed only in mixed mode");
+ fprintf(stderr,
+ "ERROR: DUP for data is allowed only in mixed mode");
return 1;
}
return 0;