You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2005/10/08 02:29:57 UTC
svn commit: r307226 - in /apr/apr/branches/1.2.x: include/apr_poll.h
poll/unix/poll.c
Author: trawick
Date: Fri Oct 7 17:29:54 2005
New Revision: 307226
URL: http://svn.apache.org/viewcvs?rev=307226&view=rev
Log:
backport from trunk:
apr_poll() - don't promise to fill in rtnevents if no event was
signalled
poll() implementation: don't bother filling in rtnevents from
uninitialized (accidental) data if no events were signalled
Modified:
apr/apr/branches/1.2.x/include/apr_poll.h
apr/apr/branches/1.2.x/poll/unix/poll.c
Modified: apr/apr/branches/1.2.x/include/apr_poll.h
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/include/apr_poll.h?rev=307226&r1=307225&r2=307226&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/include/apr_poll.h (original)
+++ apr/apr/branches/1.2.x/include/apr_poll.h Fri Oct 7 17:29:54 2005
@@ -167,17 +167,19 @@
/**
- * Poll the sockets in the poll structure
+ * Poll the descriptors in the poll structure
* @param aprset The poll structure we will be using.
- * @param numsock The number of sockets we are polling
- * @param nsds The number of sockets signalled.
+ * @param numsock The number of descriptors we are polling
+ * @param nsds The number of descriptors signalled.
* @param timeout The amount of time in microseconds to wait. This is
- * a maximum, not a minimum. If a socket is signalled, we
+ * a maximum, not a minimum. If a descriptor is signalled, we
* will wake up before this time. A negative number means
- * wait until a socket is signalled.
- * @remark The number of sockets signalled is returned in the third argument.
+ * wait until a descriptor is signalled.
+ * @remark The number of descriptors signalled is returned in the third argument.
* This is a blocking call, and it will not return until either a
- * socket has been signalled, or the timeout has expired.
+ * descriptor has been signalled, or the timeout has expired.
+ * @remark The rtnevents field in the apr_pollfd_t array will only be filled-
+ * in if the return value is APR_SUCCESS.
*/
APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
apr_int32_t *nsds,
Modified: apr/apr/branches/1.2.x/poll/unix/poll.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/poll/unix/poll.c?rev=307226&r1=307225&r2=307226&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/poll/unix/poll.c (original)
+++ apr/apr/branches/1.2.x/poll/unix/poll.c Fri Oct 7 17:29:54 2005
@@ -117,8 +117,13 @@
i = poll(pollset, num_to_poll, timeout);
(*nsds) = i;
- for (i = 0; i < num; i++) {
- aprset[i].rtnevents = get_revent(pollset[i].revents);
+ if (i > 0) { /* poll() sets revents only if an event was signalled;
+ * we don't promise to set rtnevents unless an event
+ * was signalled
+ */
+ for (i = 0; i < num; i++) {
+ aprset[i].rtnevents = get_revent(pollset[i].revents);
+ }
}
#if !defined(HAVE_VLA) && !defined(HAVE_ALLOCA)