summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-04-28 16:37:30 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:39:31 +0200
commit7e47c6d32933cc68aadb9a00072fe24500c6d5e5 (patch)
treef9ae976017b2ab93e997ce680ba35225de9b26d0
parentb81dd800fccc62754d1801a6c118ec7f629b0355 (diff)
btrfs-progs: Replace the overkill assert with normal error message.
When 'btrfs replace status' encounters an unknown dev replace status, it will cause an assert, which is somewhat overkilled and can be replaced with a normal error message. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--cmds-replace.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmds-replace.c b/cmds-replace.c
index 645dc988..9eb981ba 100644
--- a/cmds-replace.c
+++ b/cmds-replace.c
@@ -449,7 +449,10 @@ static int print_replace_status(int fd, const char *path, int once)
break;
default:
prevent_loop = 1;
- assert(0);
+ fprintf(stderr,
+ "Unknown btrfs dev replace status:%llu",
+ status->replace_state);
+ ret = -EINVAL;
break;
}
@@ -459,9 +462,9 @@ static int print_replace_status(int fd, const char *path, int once)
(unsigned long long)status->num_write_errors,
(unsigned long long)
status->num_uncorrectable_read_errors);
- if (once || prevent_loop) {
+ if (once || prevent_loop || ret) {
printf("\n");
- return 0;
+ return ret;
}
fflush(stdout);