From cvs-return-2809-apmail-apr-cvs-archive=apr.apache.org@apr.apache.org Tue Jan 29 00:38:27 2002 Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 56572 invoked by uid 500); 29 Jan 2002 00:38:27 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 56560 invoked from network); 29 Jan 2002 00:38:27 -0000 Date: 29 Jan 2002 00:38:26 -0000 Message-ID: <20020129003826.34613.qmail@icarus.apache.org> From: bnicholes@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/file_io/netware pipe.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N bnicholes 02/01/28 16:38:26 Modified: file_io/netware pipe.c Log: Fixed the way the FIFOs are being cleaned up for NetWare Revision Changes Path 1.3 +31 -2 apr/file_io/netware/pipe.c Index: pipe.c =================================================================== RCS file: /home/cvs/apr/file_io/netware/pipe.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- pipe.c 17 Oct 2001 22:47:17 -0000 1.2 +++ pipe.c 29 Jan 2002 00:38:26 -0000 1.3 @@ -72,6 +72,26 @@ 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 @@ 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 @@ 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; }