Date: Wed, 25 Aug 1999 12:21:01 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Laurynas Biveinis cc: DJGPP Workers Subject: Re: symlink() bug & fix In-Reply-To: <37C01A4C.AC7346AF@softhome.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 22 Aug 1999, Laurynas Biveinis wrote: > if (strnicmp (src_abs, dest_abs, src_base - src_abs)) > > This test fails if e.g. source is "c:\command.com" > and destination is "c:\dir\command.com", because > src_base - src_abs gives 3, so only "c:\" from both > strings are compared, which gives incorrect result. Thanks for spotting this. Here's the patch I checked in today: *** src/libc/posix/unistd/symlink.c~0 Tue Oct 28 21:22:54 1997 --- src/libc/posix/unistd/symlink.c Tue Aug 24 15:47:42 1999 *************** symlink (const char *source, const char *** 74,80 **** dest_base = tail (dest_abs); /* DJGPP symlinks must be in the same directory. */ ! if (strnicmp (src_abs, dest_abs, src_base - src_abs)) { errno = EXDEV; return -1; --- 74,81 ---- dest_base = tail (dest_abs); /* DJGPP symlinks must be in the same directory. */ ! if (src_base - src_abs != dest_base - dest_abs ! || strnicmp (src_abs, dest_abs, src_base - src_abs)) { errno = EXDEV; return -1;