Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-02-22 19:26:13 +0300
committerCorinna Vinschen <corinna@vinschen.de>2001-02-22 19:26:13 +0300
commit659b480b8ac8d798fe6a916a5570d8c1f23345cf (patch)
tree095e6ccaebf39111dbacbb49548a49f5cad1b5ab
parentff413a9894527321e27f287a997187d25202ea63 (diff)
* path.cc (symlink): Keep relative paths relative in the DOS
path inside of a shortcut. If that's impossible or the target path is already absolute save an absolute path.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc21
2 files changed, 14 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9dd5df3a5..2cd504b6c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,8 +1,8 @@
Thu Feb 22 17:09:00 2001 Corinna Vinschen <corinna@vinschen.de>
* path.cc (symlink): Keep relative paths relative in the DOS
- path inside of a shortcut. If that's impossible for some
- reason, save an absolute path.
+ path inside of a shortcut. If that's impossible or the target
+ path is already absolute save an absolute path.
Thu Feb 22 15:33:00 2001 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 54db24f8d..f0b48f844 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2209,7 +2209,7 @@ symlink (const char *topath, const char *frompath)
strcpy (from + len, ".lnk");
path_conv win32_path (from, PC_SYM_NOFOLLOW);
path_conv win32_topath;
- char cwd[MAX_PATH + 1], *cp, c = 0;
+ char cwd[MAX_PATH + 1], *cp = NULL, c = 0;
char w32topath[MAX_PATH + 1];
#endif
@@ -2265,18 +2265,21 @@ symlink (const char *topath, const char *frompath)
res = 0;
}
#else
- getcwd (cwd, MAX_PATH + 1);
- if ((cp = strrchr (from, '/')) || (cp = strrchr (from, '\\')))
+ if (!isabspath (topath))
{
- c = *cp;
- *cp = '\0';
- chdir (from);
+ getcwd (cwd, MAX_PATH + 1);
+ if ((cp = strrchr (from, '/')) || (cp = strrchr (from, '\\')))
+ {
+ c = *cp;
+ *cp = '\0';
+ chdir (from);
+ }
+ backslashify (topath, w32topath, 0);
}
- backslashify (topath, w32topath, 0);
- if (GetFileAttributes (w32topath) == (DWORD)-1)
+ if (!cp || GetFileAttributes (w32topath) == (DWORD)-1)
{
win32_topath.check (topath, PC_SYM_NOFOLLOW);
- if (win32_topath.error != ENOENT)
+ if (!cp || win32_topath.error != ENOENT)
strcpy (w32topath, win32_topath);
}
if (cp)