3 ms·
You can set errno to 0 and see if it changes.
by nitrogen 6y ago
You can set errno to 0 and see if it changes.
- jeffbee 6y agoThe syscall is allowed to set it even in case of success.
- deleted 6y ago[deleted]
- rwmj 6y agoThis is sort of right, but the behaviour is a bit subtle. errno should never be set to zero by any POSIX-compliant syscall or library call. However it may be set to something (which is non-zero) on a successful call. Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/e...
- FreeFull 6y agoI'm not sure there is any guarantee that a function that completes successfully hasn't changed the value of errno anyway.
- nitrogen 6y agoYeah, I didn't mean to imply that you can ignore the return value.