Date: Tue, 16 Jun 1998 23:55:32 +0000 (GMT) From: Terry Lambert <tlambert@primenet.com> To: current@FreeBSD.ORG Subject: Bogus errno twiddling by lstat... Message-ID: <199806162355.QAA06852@usr02.primenet.com>
next in thread | raw e-mail | index | archive | help
Try the following program:
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
main()
{
struct stat sb;
errno = 0;
printf( "lstat(fred) = %d\n", lstat( "fred", &sb));
perror( "lstat");
}
If "fred" exists in the current directory, you would expect that errno
would not have been modified, and the output will be:
lstat(fred) = 0
lstat: Undefined error: 0
However, what comes out instead is:
lstat(fred) = 0
lstat: No such file or directory
Indicating that lstat is diddling errno when it shouldn't be.
8-(.
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?199806162355.QAA06852>
