Mail Archives: djgpp-workers/1999/08/25/09:24:52
On Tue, 24 Aug 1999, Laurynas Biveinis wrote:
> I got a little bit confused by current symlink() code. The reason -
> symlink() uses helper function is_v2_prog(), which returns 1 for
> v2 DJGPP program, 0 for any other program and -1 for anything else.
> The main symlink() code calls this function to determine the type
> of linked file. And my question is - why symlink() code checks
> only for return value 0, and does not handle -1 ?
-1 means that the file doesn't exist. It is perfectly valid to create a
symlink to a non-existing file, that's why `symlink' doesn't fail for -1.
I believe the comment therein explains this:
/* When we are here, either the file exists and is a v2 executable
or it does not exist and we hope, the the user knows what he
does. */
Apart of the fact that the user might be "she" rather than "he", I don't
see any bug here ;-).
> Are there
> any reasons for keeping current code, which e.g. executes silently
> symlink("c:/io.sys", "c:/test.exe") and produces not working
> test.exe file?
This test.exe will work once the source of the link is created. This is
how symlinks work on Unix: you can say "ln -s foo bar" and have `bar'
created even thow `foo' does not exist. The link `bar' is useless in
this case as long as `foo' doesn't exist.
Our `symlink' simply emulates this behavior as best as it can.
- Raw text -