Mail Archives: cygwin-developers/1998/11/15/16:54:31
There've been a few bug reports on winsup's handling of both NULL and
empty (ie., "") pathnames. This patch should fix that.
Note that POSIX doesn't require handling of NULL pathnames at all, but
SVR4 returns EFAULT (Bad address). I'm unsure as to what winsup should
do, but being user-friendly doesn't hurt, I'm handling that as well.
Sun Nov 15 18:20:43 1998 Mumit Khan <khan AT xraylith DOT wisc DOT edu>
* path.cc (mount_info::conv_to_posix_path): Handle NULL and
empty pathnames.
(mount_info::conv_to_win32_path): Likewise.
Index: path.cc
===================================================================
RCS file: /mounts/sdb5/src/cdk-b20/winsup-snapshot/CVSROOT/winsup/path.cc,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 path.cc
--- path.cc 1998/11/13 05:46:50 1.1.1.1
+++ path.cc 1998/11/16 00:24:44
@@ -576,7 +576,19 @@ int
mount_info::conv_to_win32_path (const char *src_path, char *win32_path,
char *full_win32_path, DWORD &devn, int &unit)
{
+ if (! src_path)
+ {
+ debug_printf ("EFAULT");
+ return EFAULT;
+ }
+
int src_path_len = strlen (src_path);
+ if (src_path_len == 0)
+ {
+ debug_printf ("ENOENT");
+ return ENOENT;
+ }
+
int trailing_slash_p = (src_path_len > 0
&& SLASH_P (src_path[src_path_len - 1]));
@@ -751,7 +763,19 @@ int
mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
int keep_rel_p)
{
+ if (! src_path)
+ {
+ debug_printf ("EFAULT");
+ return EFAULT;
+ }
+
int src_path_len = strlen (src_path);
+ if (src_path_len == 0)
+ {
+ debug_printf ("ENOENT");
+ return ENOENT;
+ }
+
int trailing_slash_p = (src_path_len > 0
&& SLASH_P (src_path[src_path_len - 1]));
int relative_path_p = (! SLASH_P (*src_path)
- Raw text -