Skip to content

Commit

Permalink
Correct level handling in zstream recompress.
Browse files Browse the repository at this point in the history
sscanf returns number of items parsed on success and EOF on failure.

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
  • Loading branch information
rincebrain committed May 15, 2024
1 parent 04bae5e commit 1ccd214
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/zstream/zstream_recompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) == EOF) {
fprintf(stderr,
"failed to parse level '%s'\n",
optarg);
Expand Down

0 comments on commit 1ccd214

Please sign in to comment.