Correct level handling in zstream recompress.

sscanf returns number of items parsed on success and EOF on failure.

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
This commit is contained in:
Rich Ercolani 2024-05-14 20:00:33 -04:00
parent 04bae5ec95
commit 1ccd214772
1 changed files with 1 additions and 1 deletions

View File

@ -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);