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;
   }
   
  
  
  

Reply via email to