From: Christopher Faylor Date: Wed, 14 Nov 2001 04:12:11 +0000 (+0000) Subject: * syscalls.cc (_write): Allow zero length as per SUSv2. X-Git-Tag: cygnus_cvs_20020108_pre~166 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=65814395b660eb3a58c3776606b6323c2386d044;p=newlib-cygwin.git * syscalls.cc (_write): Allow zero length as per SUSv2. --- diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ba6e5ea05..ad64ad241 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2001-11-13 Christopher Faylor + + * syscalls.cc (_write): Allow zero length as per SUSv2. + 2001-11-13 Corinna Vinschen * dir.cc (mkdir): Add HIDDEN file attribute if file has leading dot diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 307d61885..848e0e44f 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -355,6 +355,9 @@ _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;