From 61e00694e799e1d54c98124880ca03a08dd5d4a2 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 18 Sep 2021 17:44:57 +0200 Subject: [PATCH] btrfs-progs: fix defrag -c option parsing The refactoring f3a132fa1b8c ("btrfs-progs: factor out compression type name parsing to common utils") caused a bug with parsing option -c with defrag: # btrfs fi defrag -v -czstd file ERROR: unknown compression type: zstd # btrfs fi defrag -v -clzo file ERROR: unknown compression type: lzo # btrfs fi defrag -v -czlib file ERROR: unknown compression type: zlib Fix it by properly checking the value representing unknown compression algorithm. Issue: #403 Signed-off-by: David Sterba --- cmds/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds/filesystem.c b/cmds/filesystem.c index 9a41137d..c338571a 100644 --- a/cmds/filesystem.c +++ b/cmds/filesystem.c @@ -835,7 +835,7 @@ static int parse_compress_type_arg(char *s) int ret; ret = parse_compress_type(s); - if (ret) { + if (ret < 0) { error("unknown compression type: %s", s); exit(1); } -- 2.35.3