diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-03-02 11:41:09 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-03-02 11:41:09 +0000 |
commit | e03f5f73381e352469a116d84480427227c04027 (patch) | |
tree | 02bffe58a078fc35290478879889dfeb06944569 /winsup/cygwin/dir.cc | |
parent | d08d72adff5eb5e2c810494043c7104cd9b3aa6c (diff) | |
download | cygnal-e03f5f73381e352469a116d84480427227c04027.tar.gz cygnal-e03f5f73381e352469a116d84480427227c04027.tar.bz2 cygnal-e03f5f73381e352469a116d84480427227c04027.zip |
* dir.cc (readdir): Fix shortcut==symlink condition.
* environ.cc: Add extern decl for `allow_winsymlinks'.
(struct parse_thing): Add entry for `[no]winsymlinks'.
* path.cc (symlink): Change to be able to create both,
symlink==shortcut and symlink==systemfile, dependent of
the setting of `allow_winsymlinks'.
* security.cc (cygwin_logon_user): Add debug output.
* shortcut.c: Add defines from path.h.
(has_exec_chars): Copy from path.h.
(check_shortcut): Check for executable file condition if not a
shortcut.
Diffstat (limited to 'winsup/cygwin/dir.cc')
-rw-r--r-- | winsup/cygwin/dir.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/dir.cc b/winsup/cygwin/dir.cc index c88fbfc57..29d8084cb 100644 --- a/winsup/cygwin/dir.cc +++ b/winsup/cygwin/dir.cc @@ -174,12 +174,21 @@ readdir (DIR * dir) /* We get here if `buf' contains valid data. */ strcpy (dir->__d_dirent->d_name, buf.cFileName); + /* Check for Windows shortcut. If it's a Cygwin or U/WIN + symlink, drop the .lnk suffix. */ if (buf.dwFileAttributes & FILE_ATTRIBUTE_READONLY) { char *c = dir->__d_dirent->d_name; int len = strlen (c); if (!strcasecmp (c + len - 4, ".lnk")) - c[len - 4] = '\0'; + { + char fbuf[MAX_PATH + 1]; + strcpy (fbuf, dir->__d_dirname); + strcat (fbuf + strlen (fbuf) - 1, dir->__d_dirent->d_name); + path_conv fpath (fbuf, PC_SYM_NOFOLLOW); + if (fpath.issymlink ()) + c[len - 4] = '\0'; + } } /* Compute d_ino by combining filename hash with the directory hash |