diff options
author | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2002-01-29 00:38:26 +0000 |
---|---|---|
committer | bnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68> | 2002-01-29 00:38:26 +0000 |
commit | 952120083ca72f0918772cbb3572e3246115d38c (patch) | |
tree | 4b25812f40891a0181c06974fdc369ad0ae6b805 /file_io | |
parent | 5baaaed975ee8030067bd234dce92aa9e4b308cb (diff) | |
download | libapr-952120083ca72f0918772cbb3572e3246115d38c.tar.gz |
Fixed the way the FIFOs are being cleaned up for NetWare
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62847 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r-- | file_io/netware/pipe.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/file_io/netware/pipe.c b/file_io/netware/pipe.c index b6a3805ef..bb86788ab 100644 --- a/file_io/netware/pipe.c +++ b/file_io/netware/pipe.c @@ -72,6 +72,26 @@ static int convert_error (int err) return err; } +apr_status_t apr_netware_pipe_cleanup(void *thefile) +{ + apr_file_t *file = thefile; + apr_status_t rv = APR_SUCCESS; + int rc; + + rc = NXClose(file->filedes); + if (rc == 0) { + file->filedes = -1; + if (file->thlock) { + rv = apr_thread_mutex_destroy(file->thlock); + } + } + else { + /* Are there any error conditions other than EINTR or EBADF? */ + rv = errno; + } + return rv; +} + static apr_status_t pipeblock(apr_file_t *thepipe) { int err; @@ -148,14 +168,17 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out if ( !(err = NXFifoOpen(0, tname, NX_O_RDONLY, 0, &filedes[0])) && !(err = NXFifoOpen(0, tname, NX_O_WRONLY, 0, &filedes[1]))) { + (*in) = (apr_file_t *)apr_pcalloc(cont, sizeof(apr_file_t)); + (*out) = (apr_file_t *)apr_pcalloc(cont, sizeof(apr_file_t)); + (*in)->cntxt = (*out)->cntxt = cont; (*in)->filedes = filedes[0]; (*out)->filedes = filedes[1]; (*in)->pipe = (*out)->pipe = 1; - (*out)->fname = - (*in)->fname = NULL; + (*out)->fname = apr_pstrdup(cont, tname); + (*in)->fname = apr_pstrdup(cont, tname);; (*in)->buffered = (*out)->buffered = 0; (*in)->blocking = @@ -175,6 +198,12 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out return convert_error (err); } + + apr_pool_cleanup_register((*in)->cntxt, (void *)(*in), apr_netware_pipe_cleanup, + apr_pool_cleanup_null); + apr_pool_cleanup_register((*out)->cntxt, (void *)(*out), apr_netware_pipe_cleanup, + apr_pool_cleanup_null); + return APR_SUCCESS; } |