LU-17000 utils: Fix negative argument passed
This patch fixes bunch of "Argument cannot be negative"
reported by Coverity.
CoverityID: 397713 ("Argument cannot be negative")
CoverityID: 397899 ("Argument cannot be negative")
Pass -rc to strerror() since rc is guaranteed to be negative.
CoverityID: 397769 ("Argument cannot be negative")
read() could return -1 on error. Check before using the value
CoverityID: 397780 ("Argument cannot be negative")
Use static allocation removing the need to call sysconf()
CoverityID: 403104 ("Argument cannot be negative")
On failure to open do not try to call close()
Fixes:
58d744e3 (LU-10092 pcc: Non-blocking PCC caching)
Fixes:
f172b116 (LU-10092 llite: Add persistent cache on client)
Fixes:
aed82919 (LU-16029 utils: add options to lr_reader to parse raw files)
Fixes:
86ba46c2 (LU-9680 obdclass: user netlink to collect devices information)
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Id51c6c184d30dce596e7ab948a6fd0768eed1503
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53796
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>