summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-07-04 03:07:01 +0000
committerChristopher Faylor <me@cgf.cx>2003-07-04 03:07:01 +0000
commit3f21478315fd782d6f3cd466cc5def88b10660b3 (patch)
tree859e61bc4c6ba3d6ee636c20359a026bccf4102e /winsup/cygwin/fhandler_disk_file.cc
parent8f856553c01d756ca8fdd5a53139f433514dad74 (diff)
downloadcygnal-3f21478315fd782d6f3cd466cc5def88b10660b3.tar.gz
cygnal-3f21478315fd782d6f3cd466cc5def88b10660b3.tar.bz2
cygnal-3f21478315fd782d6f3cd466cc5def88b10660b3.zip
* fhandler.h (FH_ENC): New enum.
(fhandler_base::get_encoded): New function. (fhandler_base::set_encoded): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::opendir): Set encoded flag in fhandler, as appropriate. (fhandler_disk_file::readdir): Unmunge filename as appropriate based on new encoding flag. * path.cc (normalize_posix_path): Don't punt on files with colons. (special_char): New function. (mount_item::fnmunge): Ditto. (fnunmunge): Ditto. (special_name): Ditto. (mount_item::build_win32): Avoid drive considerations when file is encoded. (mount_info::conv_to_win32_path): Handle encoded filenames. (mount_info::conv_to_posix_path): Ditto. (fillout_mntent): Add posix string when directory is encoded. * path.h (fnunmunge): Declare. (path_conv::is_encoded): Declare.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 48778f4fc..29206bb0c 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -607,6 +607,8 @@ fhandler_disk_file::opendir (path_conv& real_name)
res = dir;
}
+ if (real_name.isencoded ())
+ set_encoded ();
}
syscall_printf ("%p = opendir (%s)", res, get_name ());
@@ -633,9 +635,7 @@ fhandler_disk_file::readdir (DIR *dir)
}
}
else if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE)
- {
- return res;
- }
+ return res;
else if (!FindNextFileA (dir->__d_u.__d_data.__handle, &buf))
{
DWORD lasterr = GetLastError ();
@@ -650,7 +650,10 @@ fhandler_disk_file::readdir (DIR *dir)
}
/* We get here if `buf' contains valid data. */
- strcpy (dir->__d_dirent->d_name, buf.cFileName);
+ 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. */