diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index d824d8233..5c438d30e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 24 18:46:39 2001 Christopher Faylor + + * select.cc (peek_pipe): Only grab mutex when we actually got something + from the pipe. + Mon Sep 24 17:41:03 2001 Christopher Faylor * fhandler.h (fhandler_pipe::hit_eof): New method. diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index c18a37745..23012c75d 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -179,9 +179,6 @@ maintainer-clean realclean: clean # Rule to build libcygwin.a -$(LIB_NAME): new-$(DLL_NAME) $(LIBCOS) - $(AR) rcv $(LIB_NAME) $(LIBCOS) - # Rule to make stub library used by testsuite # dependency set to $(LIB_NAME) to accomodate make -j2. @@ -199,6 +196,9 @@ new-$(DLL_NAME): $(LDSCRIPT) $(DLL_OFILES) $(DEF_FILE) $(DLL_IMPORTS) $(LIBC) $( $(DLL_IMPORTS) $(MALLOC_OBJ) $(LIBM) $(LIBC) \ -lstdc++ -lgcc -lshell32 -luuid +$(LIB_NAME): new-$(DLL_NAME) $(LIBCOS) + $(AR) rcv $(LIB_NAME) $(LIBCOS) + dll_ofiles: $(DLL_OFILES) $(LIBGMON_A): $(GMON_OFILES) $(GMON_START) diff --git a/winsup/cygwin/lib/getopt.c b/winsup/cygwin/lib/getopt.c index e5e4f31a0..12763ea9b 100644 --- a/winsup/cygwin/lib/getopt.c +++ b/winsup/cygwin/lib/getopt.c @@ -77,7 +77,12 @@ extern char __declspec(dllimport) *__progname; #define IGNORE_FIRST (*options == '-' || *options == '+') #define PRINT_ERROR ((opterr) && ((*options != ':') \ || (IGNORE_FIRST && options[1] != ':'))) -#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL) +#if defined(__CYGWIN__) || defined(__MINGW32__) +# define IS_POSIXLY_CORRECT (1) +#else +# define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL) +#endif + #define PERMUTE (!IS_POSIXLY_CORRECT && !IGNORE_FIRST) /* XXX: GNU ignores PC if *options == '-' */ #define IN_ORDER (!IS_POSIXLY_CORRECT && *options == '-') diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index b01d833ef..6520f4b70 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -449,17 +449,17 @@ peek_pipe (select_record *s, int ignra, HANDLE guard_mutex = NULL) if (fh->get_device () == FH_PIPEW) /* nothing */; + else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL)) + { + select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); + n = -1; + } else if (guard_mutex && WaitForSingleObject (guard_mutex, 0) != WAIT_OBJECT_0) { select_printf ("%s, couldn't get mutex %p, %E", fh->get_name (), guard_mutex); n = 0; } - else if (!PeekNamedPipe (h, NULL, 0, NULL, (DWORD *) &n, NULL)) - { - select_printf ("%s, PeekNamedPipe failed, %E", fh->get_name ()); - n = -1; - } if (n < 0) {