Message-ID: <37C3E95E.1CDBF58D@softhome.net> Date: Wed, 25 Aug 1999 15:02:22 +0200 From: Laurynas Biveinis X-Mailer: Mozilla 4.61 [en] (Win98; I) X-Accept-Language: lt,en MIME-Version: 1.0 To: Eli Zaretskii CC: DJGPP Workers Subject: Re: symlink() & is_v2_prog() question References: Content-Type: text/plain; charset=iso-8859-4 Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Eli Zaretskii wrote: > 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 Or the file exists, but is not recognized executable : is_v2_prog("c:/djgpp/bin/gcc.exe") returns 1, is_v2_prog("c:/command.com") returns -1, is_v2_prog("c:/notexist.exe") returns -1, is_v2_prog("c:/config.sys") returns 0. > > 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. Yes, but that case symlink("c:/command.com", "c:/test.exe"), where test.exe is produced, pointing to existing command.com and not working? Should be these cases catched ? Laurynas Biveinis