Mail Archives: djgpp-workers/1997/10/14/22:46:42
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)
- Raw text -