Message-Id: <199710150246.WAA03855@delorie.com> From: Oberhumer Markus Subject: 971009: symlink.c patch To: dj AT delorie DOT com (DJ Delorie), djgpp-workers AT delorie DOT com (djgpp-workers) Date: Wed, 15 Oct 1997 03:40:25 +0100 (MET) Return-Read-To: markus DOT oberhumer AT jk DOT uni-linz DOT ac DOT at Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk Subject: 971009: symlink.c patch *** SYMLINK.ORG Thu Oct 9 18:38:32 1997 --- SYMLINK.C Mon Oct 13 18:44:06 1997 *************** *** 20,24 **** tail (const char *path) { ! const char *p = path ? path + strlen (path) - 1 : path; if (p) --- 20,24 ---- tail (const char *path) { ! const char *p = path && path[0] ? path + strlen (path) - 1 : path; if (p) *************** *** 97,102 **** /* Allow to say `ln -s src dest' when we really mean `src.exe' and `dest.exe' */ ! np = src_abs + strlen (src_abs) - 4; ! if (stricmp (np, EXE_SUFFIX)) { strcat (src_abs, EXE_SUFFIX); --- 97,102 ---- /* Allow to say `ln -s src dest' when we really mean `src.exe' and `dest.exe' */ ! np = src_abs + strlen (src_abs); ! if (np - src_abs > 4 && stricmp (np - 4, EXE_SUFFIX) != 0) { strcat (src_abs, EXE_SUFFIX); *************** *** 164,171 **** /* `stubedit' needs its argument with the .EXE suffix explicit. */ ! np = dest_abs + strlen (dest_abs) - 4; ! if (stricmp (np, EXE_SUFFIX)) strcat (dest_abs, EXE_SUFFIX); if (spawnlp (P_WAIT, STUBIFY, STUBIFY, "-g", dest_abs, (char *)0) --- 164,174 ---- /* `stubedit' needs its argument with the .EXE suffix explicit. */ ! np = dest_abs + strlen (dest_abs); ! if (np - dest_abs > 4 && stricmp (np - 4, EXE_SUFFIX) != 0) strcat (dest_abs, EXE_SUFFIX); + /* Any file is already a link to itself. */ + if (stricmp (src_abs, dest_abs) == 0) + return 0; if (spawnlp (P_WAIT, STUBIFY, STUBIFY, "-g", dest_abs, (char *)0)