Handle ENOTTY with the correct error code for ioctl calls

Fixes half of https://github.com/fwupd/fwupd/discussions/4810
This commit is contained in:
Richard Hughes 2022-07-08 16:14:40 +01:00
parent cb0966858d
commit 6f5ebc5492

View File

@ -1534,11 +1534,19 @@ fu_udev_device_ioctl(FuUdevDevice *self,
"permission denied");
return FALSE;
}
if (errno == ENOTTY) {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"permission denied");
return FALSE;
}
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_INTERNAL,
"ioctl error: %s",
strerror(errno));
"ioctl error: %s [%i]",
strerror(errno),
errno);
#else
g_set_error(error, FWUPD_ERROR, FWUPD_ERROR_INTERNAL, "unspecified ioctl error");
#endif