* fhandler_disk_file.cc (fhandler_disk_file::readdir): Reorganize to avoid

inappropriate .lnk extensions with munged filenames under managed mode.
This commit is contained in:
Christopher Faylor 2003-11-27 23:27:23 +00:00
parent cc2a11e0d0
commit 93eba3cb60
2 changed files with 14 additions and 8 deletions

View File

@ -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

View File

@ -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)",