aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-12-03 20:30:06 +0000
committerChristopher Faylor <me@cgf.cx>2001-12-03 20:30:06 +0000
commit3f3380323cdd335fc2f9a3f7dab39bdee6e54b8a (patch)
tree4626264ed4abb379951163d8ed232a156da0c3a5
parentb2d508465b4cc3fc4c9f46fb479649244ef8a730 (diff)
downloadnewlib-unlabeled-1.188.2.zip
newlib-unlabeled-1.188.2.tar.gz
newlib-unlabeled-1.188.2.tar.bz2
* net.cc (cygwin_getsockopt): Allow NULL optval.github/unlabeled-1.188.2unlabeled-1.188.2
* path.cc (mount_info::read_cygdrive_info_from_registry): Don't write cygdrive to registry if it doesn't exist. * path.cc (mount_info::conv_to_win32_path): Avoid returning error if cygdrive == '/'. (mount_info::cygdrive_win32_path): Return 0 if invalid cygdrive path.
-rw-r--r--winsup/cygwin/path.cc42
1 files changed, 18 insertions, 24 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index af30927..4938b46 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1389,12 +1389,15 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst,
dst[0] = '\0';
if (mount_table->cygdrive_len > 1)
devn = FH_CYGDRIVE;
+ goto out;
}
- else if (!cygdrive_win32_path (pathbuf, dst, unit))
+ else if (cygdrive_win32_path (pathbuf, dst, unit))
+ {
+ *flags = cygdrive_flags;
+ goto out;
+ }
+ else if (mount_table->cygdrive_len > 1)
return ENOENT;
- else
- *flags = cygdrive_flags;
- goto out;
}
int chrooted_path_len;
@@ -1518,8 +1521,9 @@ mount_info::cygdrive_win32_path (const char *src, char *dst, int& unit)
const char *p = src + cygdrive_len;
if (!isalpha (*p) || (!isdirsep (p[1]) && p[1]))
{
- res = unit = -1;
+ unit = -1;
dst[0] = '\0';
+ res = 0;
}
else
{
@@ -1528,9 +1532,10 @@ mount_info::cygdrive_win32_path (const char *src, char *dst, int& unit)
strcpy (dst + 2, p + 1);
backslashify (dst, dst, !dst[2]);
unit = dst[0];
+ res = 1;
}
debug_printf ("src '%s', dst '%s'", src, dst);
- return 1;
+ return res;
}
/* conv_to_posix_path: Ensure src_path is a POSIX path.
@@ -1862,8 +1867,7 @@ mount_info::read_cygdrive_info_from_registry ()
/* reg_key for user path prefix in HKEY_CURRENT_USER. */
reg_key r;
- if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive),
- "") != 0)
+ if (r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive), "") != 0)
{
/* Didn't find the user path prefix so check the system path prefix. */
@@ -1873,22 +1877,12 @@ mount_info::read_cygdrive_info_from_registry ()
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
NULL);
- if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive, sizeof (cygdrive),
- "") != 0)
- {
- /* Didn't find either so write the default to the registry and use it.
- NOTE: We are writing and using the user path prefix. */
- write_cygdrive_info_to_registry (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX,
- MOUNT_AUTO);
- }
- else
- {
- /* Fetch system cygdrive_flags from registry; returns MOUNT_AUTO on
- error. */
- cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
- slashify (cygdrive, cygdrive, 1);
- cygdrive_len = strlen(cygdrive);
- }
+ if (r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, cygdrive,
+ sizeof (cygdrive), ""))
+ strcpy (cygdrive, CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX);
+ cygdrive_flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
+ slashify (cygdrive, cygdrive, 1);
+ cygdrive_len = strlen (cygdrive);
}
else
{