Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jun 1998 21:01:43 -0500 (CDT)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        tlambert@primenet.com
Cc:        peter@netplex.com.au, tlambert@primenet.com, current@FreeBSD.ORG
Subject:   Re: Bogus errno twiddling by lstat...
Message-ID:  <199806190201.VAA06960@detlev.UUCP>
In-Reply-To: <199806171950.MAA25326@usr01.primenet.com> (message from Terry Lambert on Wed, 17 Jun 1998 19:50:35 %2B0000 (GMT))
References:   <199806171950.MAA25326@usr01.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>> 1: This is a classic programming error.. You're not really supposed to be 
>> looking at the value of errno except right after a -1 return from 
>> something.
> I know I'm not supposed to be.  However, it's not supposed to be diddling
> the errno.
[snip]
> This is irrlevent, since the printf did not fail.  The errno is not
> supposed to be manipulated across a non-failing system call, nor
> across anon-failing library routine which pretends to be atomic (per
> ANSI requirements for stdio/stdlib/etc.).

Er... IIRC, a function can set errno to a nonzero value whether or not
there is an error, so long as the function does not rely on the value
of errno to report the existance of errors (eg, strtol).  References:
ANSI 4.1.3, 4.9.10.3, ISO 7.1.4, 7.9.10.3.

Happy hacking,
joelh

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806190201.VAA06960>