In message: <[EMAIL PROTECTED]> Daniel Molina Wegener <[EMAIL PROTECTED]> writes: : Any way to reset errno?
errno = 0;
Routines that return an error status in errno generally don't set it to 0 to mean no error.
Which implies errno should never need to be set to zero since the convention is to only look at errno if a system call fails. The only time errno needs to be explicitly set (to any value) is when preserving the error value between system calls. Such as:
if (write(fd, buf, len) < 0) {
int saved_errno; saved_errno = errno;
close(fd); /* ignore any error */
errno = saved_errno;
return -1;
}
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

