From 3e0576957bc97a8fe16b3d8011b3793d5850b9dd Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 6 Sep 2000 01:56:17 +0000 Subject: [PATCH] * path.cc (normalize_posix_path): Deal with error return from cygcwd.get. (normalize_win32_path): Ditto. (mount_info::conv_to_win32_path): Ditto. (cwdstuff::get): Set buf to NULL on error. --- winsup/cygwin/ChangeLog | 7 +++++++ winsup/cygwin/path.cc | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e6be90e20..4df56a562 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +Tue Sep 5 21:36:15 2000 Christopher Faylor + + * path.cc (normalize_posix_path): Deal with error return from cygcwd.get. + (normalize_win32_path): Ditto. + (mount_info::conv_to_win32_path): Ditto. + (cwdstuff::get): Set buf to NULL on error. + Tue Sep 5 17:49:34 2000 Christopher Faylor * path.cc (readlink): 'max' should be a 'min' or we'll suffer diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 2033d257c..705603cc7 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -536,7 +536,8 @@ normalize_posix_path (const char *src, char *dst) if (!isslash (src[0])) { char cwd[MAX_PATH]; - cygcwd.get (cwd); /* FIXME: check return value */ + if (!cygcwd.get (cwd)) + return get_errno (); if (strlen (cwd) + 1 + strlen (src) >= MAX_PATH) { debug_printf ("ENAMETOOLONG = normalize_posix_path (%s)", src); @@ -639,7 +640,8 @@ normalize_win32_path (const char *src, char *dst) if (!SLASH_P (src[0]) && strchr (src, ':') == NULL) { char cwd[MAX_PATH]; - cygcwd.get (cwd, 0); /* FIXME: check return value */ + if (!cygcwd.get (cwd, 0)) + return get_errno (); if (strlen (cwd) + 1 + strlen (src) >= MAX_PATH) { debug_printf ("ENAMETOOLONG = normalize_win32_path (%s)", src); @@ -1043,7 +1045,8 @@ fillin: else if (isrelpath) { char cwd_win32[MAX_PATH]; - cygcwd.get (cwd_win32, 0); /* FIXME: check return value someday */ + if (!cygcwd.get (cwd_win32, 0)) + return get_errno (); unsigned cwdlen = strlen (cwd_win32); if (path_prefix_p (cwd_win32, dst, cwdlen)) { @@ -2950,7 +2953,10 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) debug_printf("myself->root: %s, posix: %s", myself->root, posix); if (strlen (tocopy) >= ulen) - set_errno (ERANGE); + { + set_errno (ERANGE); + buf = NULL; + } else { strcpy (buf, tocopy);