summaryrefslogtreecommitdiff
path: root/btrfstune.c
diff options
context:
space:
mode:
authorFan Chengniang <fancn.fnst@cn.fujitsu.com>2015-01-09 16:11:42 +0800
committerDavid Sterba <dsterba@suse.cz>2015-01-14 16:51:16 +0100
commit6eafa191c09f141831dcd77e7b9241d41fb35680 (patch)
treee8577886e922ffb70286b1f5fccb4207c41b545b /btrfstune.c
parent27ceeed1a7b7fedcbe19180a22df334d9cfadcc2 (diff)
btrfs-progs: btrfstune: fix multiple options error
when we use multiple options, error return status will be override by the last option status. example: btrfstune -S 1 -r /dev/loop0 when -S option fails and -r option succeeds, return value is 0, rather than 1, where 1 is the right return status. Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'btrfstune.c')
-rw-r--r--btrfstune.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/btrfstune.c b/btrfstune.c
index 050418a7..cba00a8c 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -111,6 +111,7 @@ int main(int argc, char *argv[])
{
struct btrfs_root *root;
int success = 0;
+ int total = 0;
int extrefs_flag = 0;
int seeding_flag = 0;
u64 seeding_value = 0;
@@ -188,19 +189,22 @@ int main(int argc, char *argv[])
ret = update_seeding_flag(root, seeding_value);
if (!ret)
success++;
+ total++;
}
if (extrefs_flag) {
enable_extrefs_flag(root);
success++;
+ total++;
}
if (skinny_flag) {
enable_skinny_metadata(root);
success++;
+ total++;
}
- if (success > 0) {
+ if (success == total) {
ret = 0;
} else {
root->fs_info->readonly = 1;