From a043b60f1eabcdd72f30b692565a2c982b1a1e8a Mon Sep 17 00:00:00 2001 From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> Date: Thu, 16 May 2024 18:37:50 -0400 Subject: [PATCH] Correct level handling in zstream recompress. sscanf returns number of items parsed on success and EOF on failure. Reviewed-by: Adam Moss Reviewed-by: Paul Dagnelie Reviewed-by: Brian Behlendorf Reviewed-by: Rob Norris Signed-off-by: Rich Ercolani Closes #16198 --- cmd/zstream/zstream_recompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/zstream/zstream_recompress.c b/cmd/zstream/zstream_recompress.c index 8392ef3de7..f9e01d1aa4 100644 --- a/cmd/zstream/zstream_recompress.c +++ b/cmd/zstream/zstream_recompress.c @@ -77,7 +77,7 @@ zstream_do_recompress(int argc, char *argv[]) while ((c = getopt(argc, argv, "l:")) != -1) { switch (c) { case 'l': - if (sscanf(optarg, "%d", &level) != 0) { + if (sscanf(optarg, "%d", &level) != 1) { fprintf(stderr, "failed to parse level '%s'\n", optarg);