Skip to content

Conversation

ssgelm
Copy link
Contributor

@ssgelm ssgelm commented Jan 13, 2022

As of torvalds/linux@1b8b208, unsupported ioctls now return ENOTTY instead of EINVAL. This change was also backported to the 5.10 stable branch, so it's a problem on the current release of many Linux distros now.

As of torvalds/linux@1b8b208,
unsupported ioctls now return ENOTTY instead of EINVAL. This change was
also backported to the 5.10 stable branch, so it's a problem on the
current release of many Linux distros now.
Copy link

@puellanivis puellanivis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

// some ioctls fail against char devices if they do not
// support a particular feature
if (runtime.GOOS == "darwin" && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {
if ((runtime.GOOS == "darwin" || runtime.GOOS == "linux") && err == unix.ENOTTY) || (runtime.GOOS == "linux" && err == unix.EINVAL) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to put the (err == unix.EINVAL || err == unix.ENOTTY) together? Or maybe this is getting complex enough, we want to split it up in a switch?

🤷‍♀️ I mean, the code should work fine either way…

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel strongly either way. Happy to change it however you'd like, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants