mirror of
https://github.com/CTCaer/hidapi.git
synced 2024-11-23 10:09:46 +00:00
linux: Check value returned by fstat(2)
Problem reported by the Coverity tool CID 1042532 (#1 of 1): Unchecked return value from library (CHECKED_RETURN)2. check_return: Calling function "fstat(dev->device_handle, &s)" without checking return value. This library function may fail and return an error code.
This commit is contained in:
parent
b5b2e1779b
commit
98629a104b
@ -274,7 +274,9 @@ static int get_device_string(hid_device *dev, enum device_string_id key, wchar_t
|
||||
}
|
||||
|
||||
/* Get the dev_t (major/minor numbers) from the file handle. */
|
||||
fstat(dev->device_handle, &s);
|
||||
ret = fstat(dev->device_handle, &s);
|
||||
if (-1 == ret)
|
||||
return ret;
|
||||
/* Open a udev device from the dev_t. 'c' means character device. */
|
||||
udev_dev = udev_device_new_from_devnum(udev, 'c', s.st_rdev);
|
||||
if (udev_dev) {
|
||||
|
Loading…
Reference in New Issue
Block a user