]> git.ipfire.org Git - thirdparty/mdadm.git/commit
restripe: fix ignoring return value of ‘read’ and lseek
authorGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Mon, 18 May 2020 21:53:36 +0000 (23:53 +0200)
committerJes Sorensen <jsorensen@fb.com>
Tue, 19 May 2020 00:24:29 +0000 (20:24 -0400)
commitd92cee7b374db9944b63bdd6c1784a2dd90ee9ca
treeab4562313e4c6d67f23a1b06d317c5c64f0694cb
parent7d90f7603af6b59e7144cef6617a1e9dd42161bd
restripe: fix ignoring return value of ‘read’ and lseek

Got below error when run "make everything".

restripe.c: In function ‘test_stripes’:
restripe.c:870:4: error: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Werror=unused-result]
    read(source[i], stripes[i], chunk_size);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix it by check the return value of ‘read’, and free memory
in the failure case.

And check the return value of lseek as well per Jes's comment.

Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
restripe.c