Date: Thu, 20 Mar 2003 06:19:16 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: rich AT phekda DOT freeserve DOT co DOT uk Message-Id: <2593-Thu20Mar2003061916+0200-eliz@elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <3E78DB55.6A8E9C59@phekda.freeserve.co.uk> (message from Richard Dawe on Wed, 19 Mar 2003 21:04:21 +0000) Subject: Re: fchdir, revision 2 [PATCH] References: <7458-Wed19Mar2003174724+0200-eliz AT elta DOT co DOT il> <3E78AC79 DOT D615F93B AT phekda DOT freeserve DOT co DOT uk> <7458-Wed19Mar2003223447+0200-eliz AT elta DOT co DOT il> <3E78DB55 DOT 6A8E9C59 AT phekda DOT freeserve DOT co DOT uk> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Wed, 19 Mar 2003 21:04:21 +0000 > From: Richard Dawe > > According to POSIX: You can't get a file descriptor for a symlink using > open(). For a symlink, open() should follow the symlink. > > We have the additional options: > > * O_NOFOLLOW, which causes open() to fail, if the file is a symlink. > * O_NOLINK, which causes open() to actually open the symlink as a normal file. > > If you've used O_NOLINK, I think it's reasonable to return info about the > symlink. Okay, thanks. So this logic should be inside `open', and `fstat' doesn't have to care about the issue. > I suppose you could get a handle to a symlink using _open(). But in that case > the file descriptor was created outside the normal POSIX I/O functions. I > think it's reasonable to treat the "symlink" as a normal file in that case. Yes, "then don't do that" is the usual response top such situations.