diff options
author | Patrick Latifi <pat@cvs.openbsd.org> | 2004-11-30 00:14:52 +0000 |
---|---|---|
committer | Patrick Latifi <pat@cvs.openbsd.org> | 2004-11-30 00:14:52 +0000 |
commit | 44bf1468deea38e5f0232d96c87d404aaa2371a3 (patch) | |
tree | 6f1764954ff22baadf4b3ba363eb21555ce6a968 /lib/libpthread | |
parent | 34b454fb0d8c94e65574a225af21db8275153566 (diff) |
* make sure we leave the thread's cancellation point before we return
* plug a memory leak and FD_UNLOCK properly in writev
ok marc
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/uthread/uthread_poll.c | 3 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_readv.c | 3 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_writev.c | 8 |
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/libpthread/uthread/uthread_poll.c b/lib/libpthread/uthread/uthread_poll.c index 7dbb9c30ead..dc276fa350a 100644 --- a/lib/libpthread/uthread/uthread_poll.c +++ b/lib/libpthread/uthread/uthread_poll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_poll.c,v 1.10 2004/01/19 17:53:38 millert Exp $ */ +/* $OpenBSD: uthread_poll.c,v 1.11 2004/11/30 00:14:51 pat Exp $ */ /* * Copyright (c) 1999 Daniel Eischen <eischen@vigrid.com> * All rights reserved. @@ -73,6 +73,7 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout) } else if (timeout < 0) { /* a timeout less than zero but not == INFTIM is invalid */ errno = EINVAL; + _thread_leave_cancellation_point(); return (-1); } diff --git a/lib/libpthread/uthread/uthread_readv.c b/lib/libpthread/uthread/uthread_readv.c index 80a91e29637..f87fa652c38 100644 --- a/lib/libpthread/uthread/uthread_readv.c +++ b/lib/libpthread/uthread/uthread_readv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_readv.c,v 1.6 2004/01/01 08:19:33 brad Exp $ */ +/* $OpenBSD: uthread_readv.c,v 1.7 2004/11/30 00:14:51 pat Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -62,6 +62,7 @@ readv(int fd, const struct iovec * iov, int iovcnt) /* File is not open for read: */ errno = EBADF; _FD_UNLOCK(fd, FD_READ); + _thread_leave_cancellation_point(); return (-1); } diff --git a/lib/libpthread/uthread/uthread_writev.c b/lib/libpthread/uthread/uthread_writev.c index fd1c553ef23..6d1981f4461 100644 --- a/lib/libpthread/uthread/uthread_writev.c +++ b/lib/libpthread/uthread/uthread_writev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_writev.c,v 1.8 2004/01/01 08:19:33 brad Exp $ */ +/* $OpenBSD: uthread_writev.c,v 1.9 2004/11/30 00:14:51 pat Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -68,6 +68,7 @@ writev(int fd, const struct iovec * iov, int iovcnt) malloc(iovcnt * sizeof(struct iovec))) == NULL) { /* Insufficient memory: */ errno = ENOMEM; + _thread_leave_cancellation_point(); return (-1); } } @@ -85,6 +86,9 @@ writev(int fd, const struct iovec * iov, int iovcnt) /* File is not open for write: */ errno = EBADF; _FD_UNLOCK(fd, FD_WRITE); + if (p_iov != liov) + free(p_iov); + _thread_leave_cancellation_point(); return (-1); } @@ -211,7 +215,7 @@ writev(int fd, const struct iovec * iov, int iovcnt) /* Return the number of bytes written: */ ret = num; } - _FD_UNLOCK(fd, FD_RDWR); + _FD_UNLOCK(fd, FD_WRITE); } /* If memory was allocated for the array, free it: */ |