* exceptions.cc: Add stdlib.h include for alloca declaration.

* poll.cc: Ditto.
* termios.cc: Ditto.
* syscalls.cc (_write): Only allow zero length when fd is valid.
This commit is contained in:
Christopher Faylor 2001-11-15 03:25:52 +00:00
parent d590035529
commit e2b3dc2580
5 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,13 @@
2001-11-14 Christopher Faylor <cgf@redhat.com>
* exceptions.cc: Add stdlib.h include for alloca declaration.
* poll.cc: Ditto.
* termios.cc: Ditto.
2001-11-14 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (_write): Only allow zero length when fd is valid.
2001-11-14 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_disk_file::fstat): Add setting access time

View File

@ -11,6 +11,7 @@ details. */
#include "winsup.h"
#include <imagehlp.h>
#include <errno.h>
#include <stdlib.h>
#include "exceptions.h"
#include "sync.h"

View File

@ -12,6 +12,7 @@
#include <sys/time.h>
#include <sys/poll.h>
#include <errno.h>
#include <stdlib.h>
#include "security.h"
#include "fhandler.h"
#include "path.h"

View File

@ -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);

View File

@ -14,6 +14,7 @@ details. */
#include "winsup.h"
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "cygerrno.h"
#include "security.h"
#include "fhandler.h"