apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 pipe.c
Date Fri, 24 Jan 2003 18:22:13 GMT
wrowe       2003/01/24 10:22:13

  Modified:    file_io/win32 pipe.c
  Log:
    Expand the set/get semantic slightly... always allow the user to recover
    the timeout (usually -1 for files and blocking pipes) and allow the user
    to set the timeout to -1 always.  Returns APR_EINVAL (new behavior) when
    the user attempts to set the timeout of a blocking pipe.
  
    While most of our pipes should become non-blocking, console apps cannot
    be passed a non-blocking pipe handle.
  
  Revision  Changes    Path
  1.51      +15 -7     apr/file_io/win32/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/pipe.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- pipe.c	24 Jan 2003 17:15:55 -0000	1.50
  +++ pipe.c	24 Jan 2003 18:22:13 -0000	1.51
  @@ -71,20 +71,28 @@
   
   APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t
timeout)
   {
  -    if (thepipe->pipe == 1) {
  +    /* Always OK to unset timeouts */
  +    if (timeout == -1) {
           thepipe->timeout = timeout;
           return APR_SUCCESS;
       }
  -    return APR_EINVAL;
  +    if (!thepipe->pipe) {
  +        return APR_ENOTIMPL;
  +    }
  +    if (timeout && !(thepipe->pOverlapped)) {
  +        /* Cannot be nonzero if a pipe was opened blocking
  +         */
  +        return APR_EINVAL;
  +    }
  +    thepipe->timeout = timeout;
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t
*timeout)
   {
  -    if (thepipe->pipe == 1) {
  -        *timeout = thepipe->timeout;
  -        return APR_SUCCESS;
  -    }
  -    return APR_EINVAL;
  +    /* Always OK to get the timeout (even if it's unset ... -1) */
  +    *timeout = thepipe->timeout;
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t
*p)
  
  
  

Mime
View raw message