Date: Thu, 17 Aug 2000 11:52:42 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: lauras AT softhome DOT net Message-Id: <2950-Thu17Aug2000115242+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5b CC: djgpp-workers AT delorie DOT com In-reply-to: <399B954E.4BC4ECC@softhome.net> (message from Laurynas Biveinis on Thu, 17 Aug 2000 09:33:34 +0200) Subject: Re: Symlinks & fstat References: <399B00B3 DOT 1AA2C454 AT softhome DOT net> <1858-Thu17Aug2000010725+0300-eliz AT is DOT elta DOT co DOT il> <399B954E DOT 4BC4ECC AT softhome DOT net> 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: Thu, 17 Aug 2000 09:33:34 +0200 > From: Laurynas Biveinis > > fstat() needs to set S_IFLNK bit, somehow. Currently I do that with > saving current file position, seeking to the beginning, reading first > few bytes, comparing, restoring file position. Everything is pretty nice > until FSEXT comes to scene. What you described above should be a primitive which can be hooked. > Now if I provide > int __internal_readlink(const char * path, int fhandle, char * buf, int max); Assuming that we won't get the user into trouble by requesting to have the same hook that is called both from __FSEXT_call_open_handlers and by a handle-related code, this is okay, I think. > BTW, if file was opened for write only, __internal_readlink() would > fail here This should be documented. The case seems to be too marginal to be important though: you need the _link_, not its target, to be open write-only, and applications shouldn't need to do that. Anyway, I think that fstat already has some degradation for write-only files, because _is_executable needs to read the magic signature.