Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 1998 19:50:35 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        peter@netplex.com.au (Peter Wemm)
Cc:        tlambert@primenet.com, current@FreeBSD.ORG
Subject:   Re: Bogus errno twiddling by lstat...
Message-ID:  <199806171950.MAA25326@usr01.primenet.com>
In-Reply-To: <199806170032.IAA06067@spinner.netplex.com.au> from "Peter Wemm" at Jun 17, 98 08:32:56 am

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.


> 2: the no such file or directory is actually stdio calling malloc, which 
> is doing a readlink on /etc/malloc.conf, which probably doesn't exist.

I knew that it was malloc, though I hadn't bothered to find out why.

The malloc.conf access is triggered in the ld.so.  It should *not*
be retriggered in stdio, in any case (ie: the malloc code should be
caching the return values).


> 3: You're calling stdio (ie: printf) *after* lstat() so you've gotten 
> what's coming to you. :-)  You're initializing the entire stdio system 
> after calling lseek().  It's stdio that's leaking the errno.

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.).

Anyway, I wasn't relying on it, that was just the minimal case that
replicated the error.  The perror() with errno == 0 is supposed to
print out the "No error" message (else why have it there?).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

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?199806171950.MAA25326>