apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/file_io/unix filedup.c
Date Sat, 12 Jan 2002 15:07:17 GMT
dreid       02/01/12 07:07:17

  Modified:    file_io/unix filedup.c
  Log:
  I don't like missing errors, so we'll now actually return the error if we have one.
  
  Revision  Changes    Path
  1.42      +7 -2      apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/filedup.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- filedup.c	11 Jan 2002 09:04:51 -0000	1.41
  +++ filedup.c	12 Jan 2002 15:07:17 -0000	1.42
  @@ -62,6 +62,8 @@
                                 apr_file_t *old_file, apr_pool_t *p,
                                 int which_dup)
   {
  +    int rv;
  +    
       if ((*new_file) == NULL) {
           if (which_dup == 1) {
               (*new_file) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t));
  @@ -76,11 +78,14 @@
       }
   
       if (which_dup == 2) {
  -        dup2(old_file->filedes, (*new_file)->filedes);
  +        rv = dup2(old_file->filedes, (*new_file)->filedes);
       } else {
  -        (*new_file)->filedes = dup(old_file->filedes); 
  +        rv = ((*new_file)->filedes = dup(old_file->filedes)); 
       }
   
  +    if (rv == -1)
  +        return errno;
  +    
       (*new_file)->fname = apr_pstrdup(p, old_file->fname);
       (*new_file)->buffered = old_file->buffered;
   
  
  
  

Mime
View raw message