From: cgf Date: Fri, 7 May 2004 03:27:37 +0000 (+0000) Subject: Christopher Faylor X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=dc13bb3865622a2295e40c48d6969cbfa1181faa;p=pf3gnuchains%2Fpf3gnuchains3x.git Christopher Faylor * path.cc (mount_info::conv_to_posix_path): Add return. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 427a8dbba1..c611a74da0 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2004-05-07 Pierre Humblet + Christopher Faylor + + * path.cc (mount_info::conv_to_posix_path): Add return. + 2004-05-06 Pierre Humblet * path.cc (path_conv::check): Strip trailing dots and spaces and diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 8f85f13be6..d40b40f549 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1693,7 +1693,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, if (!cygheap->root.exists ()) /* nothing */; - else if (cygheap->root.ischroot_native (pathbuf)) + else if (!cygheap->root.ischroot_native (pathbuf)) + return ENOENT; + else { const char *p = pathbuf + cygheap->root.native_length (); if (*p) @@ -1703,9 +1705,8 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path, posix_path[0] = '/'; posix_path[1] = '\0'; } + goto out; } - else - return ENOENT; /* Not in the database. This should [theoretically] only happen if either the path begins with //, or / isn't mounted, or the path has a drive diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index d56d731c89..7aac92ae04 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -604,22 +604,33 @@ pthread::cancelable_wait (HANDLE object, DWORD timeout, const bool do_cancel, because WaitForMultipleObjects will return the smallest index if both objects are signaled. */ wait_objects[num++] = object; - if (is_good_object (&thread) && - thread->cancelstate != PTHREAD_CANCEL_DISABLE) - wait_objects[num++] = thread->cancel_event; - if (do_sig_wait) - wait_objects[num++] = signal_arrived; + DWORD cancel_n; + if (!is_good_object (&thread) || + thread->cancelstate == PTHREAD_CANCEL_DISABLE) + cancel_n = (DWORD) -1; + else + { + cancel_n = num++; + wait_objects[cancel_n] = thread->cancel_event; + } + + DWORD sig_n; + if (!do_sig_wait || &_my_tls != _main_tls) + sig_n = (DWORD) -1; + else + { + sig_n = num++; + wait_objects[sig_n] = signal_arrived; + } res = WaitForMultipleObjects (num, wait_objects, FALSE, timeout); - if (res == WAIT_CANCELED) + if (res == sig_n - WAIT_OBJECT_0) + res = WAIT_SIGNALED; + else if (res == cancel_n - WAIT_OBJECT_0) { - if (num == 3 || !do_sig_wait) - { - if (do_cancel) - pthread::static_cancel_self (); - } - else - res = WAIT_SIGNALED; + if (do_cancel) + pthread::static_cancel_self (); + res = WAIT_CANCELED; } return res; }