erofs-utils: mkfs: add missing `errno = 0` before strto[u]l
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 14 Feb 2025 06:24:05 +0000 (14:24 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 14 Feb 2025 06:39:59 +0000 (14:39 +0800)
commit5e05ee09a3bc7331549d8e141dac0ccaf30feda5
treea123f7f55d6f8c132816c4b378bda8ed96623768
parentd180c898bd0842eaeb54ca0073e6f444bdae8c40
erofs-utils: mkfs: add missing `errno = 0` before strto[u]l

strtoull(3) says:

```
Since strtoul() can legitimately return 0 or ULONG_MAX (ULLONG_MAX for
strtoull()) on both success and failure, the calling program should set
errno to 0 before the call, and then determine if an error occurred by
checking whether errno has a nonzero value after the call.
```

Otherwise, `--workers=` could exit with `invalid worker number`.

Fixes: 7894301e1a80 ("erofs-utils: mkfs: add `--workers=#` parameter")
Fixes: 0132cb5ea7d0 ("erofs-utils: mkfs: add `--zfeature-bits` option")
Fixes: 7550a30c332c ("erofs-utils: enable incremental builds")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20250214062407.3281416-1-hsiangkao@linux.alibaba.com
mkfs/main.c