Subject: Re: bin/23988: egcs: cc -traditional totally broken
To: None <vax@carolina.rr.com>
From: Christian Biere <christianbiere@gmx.de>
List: netbsd-bugs
Date: 01/05/2004 12:55:10
[Please, don't set the Reply-To header to an invalid address!]

vax@carolina.rr.com wrote:
> void tmp(void) {
>   int fd;
>   fd = open("/dev/null", 2, 0);
>   printf("%d, %d, %d\n", fd, lseek(fd, 0, 0), errno);
> }

CMIIW, in C function parameters get evaluated from right to left. So
the errno as printed was set by open() or something before but not
by lseek(). A function may alter errno even if it didn't fail because
you have to ignore the value of errno in case of success.
 
-- 
Christian