diff options
Diffstat (limited to 'file_io/unix/open.c')
-rw-r--r-- | file_io/unix/open.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/file_io/unix/open.c b/file_io/unix/open.c index eab278f64..589c85314 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -1,4 +1,5 @@ -/* Copyright 2000-2004 The Apache Software Foundation +/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as + * applicable. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +49,17 @@ apr_status_t apr_unix_file_cleanup(void *thefile) /* Are there any error conditions other than EINTR or EBADF? */ rv = errno; } +#ifndef WAITIO_USES_POLL + if (file->pollset != NULL) { + apr_status_t pollset_rv = apr_pollset_destroy(file->pollset); + /* If the file close failed, return its error value, + * not apr_pollset_destroy()'s. + */ + if (rv == APR_SUCCESS) { + rv = pollset_rv; + } + } +#endif /* !WAITIO_USES_POLL */ return rv != APR_SUCCESS ? rv : flush_rv; } @@ -158,9 +170,10 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, (*new)->dataRead = 0; (*new)->direction = 0; #ifndef WAITIO_USES_POLL - /* Create a pollset with room for one descriptor. */ - /* ### check return codes */ - (void) apr_pollset_create(&(*new)->pollset, 1, pool, 0); + /* Start out with no pollset. apr_wait_for_io_or_timeout() will + * initialize the pollset if needed. + */ + (*new)->pollset = NULL; #endif if (!(flag & APR_FILE_NOCLEANUP)) { apr_pool_cleanup_register((*new)->pool, (void *)(*new), @@ -219,9 +232,10 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, (*file)->buffered = (flags & APR_BUFFERED) > 0; #ifndef WAITIO_USES_POLL - /* Create a pollset with room for one descriptor. */ - /* ### check return codes */ - (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0); + /* Start out with no pollset. apr_wait_for_io_or_timeout() will + * initialize the pollset if needed. + */ + (*file)->pollset = NULL; #endif if ((*file)->buffered) { |