Skip to content

Commit ad985ae

Browse files
Marc ZyngierYouw
Marc Zyngier
authored andcommitted
linux/hidraw: Don't consider open returning 0 as an error
The open systcall is allowed to return 0 as a valid file descriptor, and considering it an error breaks environments where unnecessary fds are closed before executing untrusted processes. Fixes: #199 Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 3fe9b78 commit ad985ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linux/hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
668668
dev->device_handle = open(path, O_RDWR);
669669

670670
/* If we have a good handle, return it. */
671-
if (dev->device_handle > 0) {
671+
if (dev->device_handle >= 0) {
672672
/* Set device error to none */
673673
register_device_error(dev, NULL);
674674

0 commit comments

Comments
 (0)