diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 61a68933b..9c5fa545e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,7 +1,17 @@ +2001-11-14 Christopher Faylor + + * exceptions.cc: Add stdlib.h include for alloca declaration. + * poll.cc: Ditto. + * termios.cc: Ditto. + +2001-11-14 Christopher Faylor + + * syscalls.cc (_write): Only allow zero length when fd is valid. + 2001-11-14 Corinna Vinschen * fhandler.cc (fhandler_disk_file::fstat): Add setting access time - and creation time to last modification time for files on filesystems + and creation time to last modification time for files on filesystems not supporting multiple timestamps. (fhandler_disk_file::fstat_helper): Set access time and creation time in incoming Windows structure instead of in stat buf to avoid diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 560eab43c..41a1319db 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -11,6 +11,7 @@ details. */ #include "winsup.h" #include #include +#include #include "exceptions.h" #include "sync.h" diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index 76f8c35dd..8b73c5afd 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include "security.h" #include "fhandler.h" #include "path.h" diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 848e0e44f..d0896169b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -355,12 +355,6 @@ _read (int fd, void *ptr, size_t len) extern "C" ssize_t _write (int fd, const void *ptr, size_t len) { - if (len == 0) - return 0; - - if (__check_invalid_read_ptr_errno (ptr, len)) - return -1; - int res = -1; sigframe thisframe (mainthread); @@ -368,6 +362,16 @@ _write (int fd, const void *ptr, size_t len) if (cfd < 0) goto done; + /* No further action required for len == 0 */ + if (len == 0) + { + res = 0; + goto done; + } + + if (len && __check_invalid_read_ptr_errno (ptr, len)) + goto done; + /* Could block, so let user know we at least got here. */ if (fd == 1 || fd == 2) paranoid_printf ("write (%d, %p, %d)", fd, ptr, len); diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index f5d775fae..499072f51 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -14,6 +14,7 @@ details. */ #include "winsup.h" #include #include +#include #include "cygerrno.h" #include "security.h" #include "fhandler.h"