diff options
author | Christopher Faylor <me@cgf.cx> | 2003-11-27 23:27:23 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-11-27 23:27:23 +0000 |
commit | 93eba3cb600c4eb06a535d47137e775f4042c456 (patch) | |
tree | 8845e29b1eeebf01e3baf581f52b0c43501d9e84 | |
parent | cc2a11e0d098c27f11dc4bc930a8b9815f85bf7a (diff) | |
download | newlib-93eba3cb600c4eb06a535d47137e775f4042c456.zip newlib-93eba3cb600c4eb06a535d47137e775f4042c456.tar.gz newlib-93eba3cb600c4eb06a535d47137e775f4042c456.tar.bz2 |
* fhandler_disk_file.cc (fhandler_disk_file::readdir): Reorganize to avoid
inappropriate .lnk extensions with munged filenames under managed mode.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ad11c50..992d56f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2003-11-27 Christopher Faylor <cgf@redhat.com> + + * fhandler_disk_file.cc (fhandler_disk_file::readdir): Reorganize to + avoid inappropriate .lnk extensions with munged filenames under managed + mode. + 2003-11-26 Corinna Vinschen <corinna@vinschen.de> * sec_helper.cc (set_process_privilege): Rename restore_priv to diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index e19c196..faebc45 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -704,29 +704,29 @@ fhandler_disk_file::readdir (DIR *dir) return res; } - /* We get here if `buf' contains valid data. */ - if (get_encoded ()) - (void) fnunmunge (dir->__d_dirent->d_name, buf.cFileName); - else - 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; + char *c = buf.cFileName; int len = strlen (c); if (strcasematch (c + len - 4, ".lnk")) { char fbuf[CYG_MAX_PATH + 1]; strcpy (fbuf, dir->__d_dirname); - strcpy (fbuf + strlen (fbuf) - 1, dir->__d_dirent->d_name); + strcpy (fbuf + strlen (fbuf) - 1, c); path_conv fpath (fbuf, PC_SYM_NOFOLLOW); if (fpath.issymlink () || fpath.isspecial ()) c[len - 4] = '\0'; } } + /* We get here if `buf' contains valid data. */ + if (get_encoded ()) + (void) fnunmunge (dir->__d_dirent->d_name, buf.cFileName); + else + strcpy (dir->__d_dirent->d_name, buf.cFileName); + dir->__d_position++; res = dir->__d_dirent; syscall_printf ("%p = readdir (%p) (%s)", |