]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commit
src/ext4_resize.c: set errno to 0 before the strtoull call
authorYang Xu <xuyang2018.jy@fujitsu.com>
Mon, 17 Jan 2022 07:36:54 +0000 (15:36 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 23 Jan 2022 14:25:07 +0000 (22:25 +0800)
commita3183c6422b5014f8d6168cbf067461c1767e8bf
treebe9437013833fa74b47145d478b26ce88130a981
parentbec9f2cc9d7ad86a9bf2a602529bc20667fcfe88
src/ext4_resize.c: set errno to 0 before the strtoull call

On my test machine, ext4/033 fails even use the non-overflow size.
It reports invalid new size when using strtoull because errno is 1.

As man-pages said "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".

So add a step to set errno to 0 before strtoull call.

Fixes: 92b9c0dedace ("ext4/033: test EXT4_IOC_RESIZE_FS by calling the ioctl directly")
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/ext4_resize.c