From owner-freebsd-current Thu Jun 18 19:02:12 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA26984 for freebsd-current-outgoing; Thu, 18 Jun 1998 19:02:12 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from mail.camalott.com (root@mail.camalott.com [208.203.140.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA26973 for ; Thu, 18 Jun 1998 19:02:09 -0700 (PDT) (envelope-from joelh@gnu.org) Received: from detlev.UUCP (tex-151.camalott.com [208.229.74.151] (may be forged)) by mail.camalott.com (8.8.7/8.8.5) with ESMTP id VAA25457; Thu, 18 Jun 1998 21:01:24 -0500 Received: (from joelh@localhost) by detlev.UUCP (8.8.8/8.8.8) id VAA06960; Thu, 18 Jun 1998 21:01:43 -0500 (CDT) (envelope-from joelh) Date: Thu, 18 Jun 1998 21:01:43 -0500 (CDT) Message-Id: <199806190201.VAA06960@detlev.UUCP> To: tlambert@primenet.com CC: peter@netplex.com.au, tlambert@primenet.com, current@FreeBSD.ORG In-reply-to: <199806171950.MAA25326@usr01.primenet.com> (message from Terry Lambert on Wed, 17 Jun 1998 19:50:35 +0000 (GMT)) Subject: Re: Bogus errno twiddling by lstat... From: Joel Ray Holveck Reply-to: joelh@gnu.org References: <199806171950.MAA25326@usr01.primenet.com> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >> 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