apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/test testfile.c
Date Sat, 28 Dec 2002 20:44:56 GMT
wrowe       2002/12/28 12:44:56

  Modified:    test     testfile.c
  Log:
    You cannot close files that failed to open.
  
  Revision  Changes    Path
  1.61      +10 -2     apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testfile.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- testfile.c	15 Dec 2002 19:01:16 -0000	1.60
  +++ testfile.c	28 Dec 2002 20:44:55 -0000	1.61
  @@ -106,7 +106,13 @@
        */
       CuAssertPtrEquals(tc, NULL, thefile); 
   #endif
  -    apr_file_close(thefile);
  +    /* And this too is a bug... Win32 (correctly) does not allocate
  +     * an apr_file_t, and (correctly) returns NULL.  Closing objects
  +     * that failed to open is invalid.  Apparently someone is doing so.
  +     */
  +    if (thefile) {
  +        apr_file_close(thefile);
  +    }
   }
   
   static void test_open_read(CuTest *tc)
  @@ -200,7 +206,9 @@
                          APR_WRITE, 
                          APR_UREAD | APR_UWRITE | APR_GREAD, p);
       CuAssertIntEquals(tc, 1, APR_STATUS_IS_ENOENT(rv));
  -    apr_file_close(filetest);
  +    if (filetest) {
  +        apr_file_close(filetest);
  +    }
   }
   
   static void test_open_writecreate(CuTest *tc)
  
  
  

Mime
View raw message