From 1a21f33188bf4530967c644e0e540b6b7db09c1d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 2 Jun 2004 21:20:54 +0000 Subject: [PATCH] * spawn.cc (find_exec): Use has_slash to determine if path has a slash rather than calculating this twice. --- winsup/cygwin/ChangeLog | 9 +++++++-- winsup/cygwin/cygheap.cc | 7 ++++++- winsup/cygwin/path.cc | 10 +++++----- winsup/cygwin/spawn.cc | 8 +++----- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 390c0222f..336679291 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,8 +1,13 @@ +2004-06-02 Christophe Jaillet + + * spawn.cc (find_exec): Use has_slash to determine if path has a slash + rather than calculating this twice. + 2004-05-30 Pierre Humblet - * path.cc (mount_info::add_item): Make sure native path has drive + * path.cc (mount_info::add_item): Make sure native path has drive or UNC form. Call normalize_xxx_path instead of [back]slashify. - Remove test for double slashes. Reorganize to always debug_print. + Remove test for double slashes. Reorganize to always debug_print. 2004-05-28 Pierre Humblet diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index f5a990955..6a6aa19a5 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -369,7 +369,12 @@ cmalloc (cygheap_types x, DWORD n) MALLOC_CHECK; c = (cygheap_entry *) _cmalloc (sizeof_cygheap (n)); if (!c) - system_printf ("cmalloc returned NULL"); + { + system_printf ("cmalloc returned NULL"); +#ifdef DEBUGGING + try_to_debug (); +#endif + } return creturn (x, c, n); } diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index b09450476..105092e58 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2197,14 +2197,14 @@ mount_info::add_item (const char *native, const char *posix, unsigned mountflags posixerr = normalize_posix_path (posix, posixtmp, &posixtail); debug_printf ("%s[%s], %s[%s], %p", - native, nativeerr?error:nativetmp, - posix, posixerr?error:posixtmp, mountflags); + native, nativeerr ? error : nativetmp, + posix, posixerr ? error : posixtmp, mountflags); - if (nativeerr || posixerr) + if (nativeerr || posixerr) { set_errno (nativeerr?:posixerr); - return -1; - } + return -1; + } /* Make sure both paths do not end in /. */ if (nativetail > nativetmp + 1 && nativetail[-1] == '\\') diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index dc2bb254c..225e1ce0f 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -114,11 +114,9 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv, /* Return the error condition if this is an absolute path or if there is no PATH to search. */ - if (strchr (name, '/') || strchr (name, '\\') || - isdrive (name) || - !(winpath = getwinenv (mywinenv)) || - !(path = winpath->get_native ()) || - *path == '\0') + if (has_slash || strchr (name, '\\') || isdrive (name) + || !(winpath = getwinenv (mywinenv)) + || !(path = winpath->get_native ()) || *path == '\0') goto errout; debug_printf ("%s%s", mywinenv, path);