? .DS_Store ? .gdb_history ? cURL ? diff.txt ? docs/.DS_Store ? src/.gdb_history ? tests/.gdb_history ? tests/.memanalyze.pl.swp Index: lib/file.c =================================================================== RCS file: /cvsroot/curl/curl/lib/file.c,v retrieving revision 1.88 diff -u -r1.88 file.c --- lib/file.c 27 Jun 2007 20:15:48 -0000 1.88 +++ lib/file.c 28 Jun 2007 09:39:37 -0000 @@ -231,8 +231,7 @@ failf(data, "Can't open %s for writing", file->path); return CURLE_WRITE_ERROR; } - close(fd); - fp = fopen(file->path, "wb"); + fp = fdopen(fd, "wb"); } if(!fp) { Index: lib/memdebug.c =================================================================== RCS file: /cvsroot/curl/curl/lib/memdebug.c,v retrieving revision 1.52 diff -u -r1.52 memdebug.c --- lib/memdebug.c 15 May 2007 00:36:56 -0000 1.52 +++ lib/memdebug.c 28 Jun 2007 09:39:37 -0000 @@ -280,6 +280,16 @@ return res; } +FILE *curl_fdopen(int filedes, const char *mode, + int line, const char *source) +{ + FILE *res=(fdopen)(filedes, mode); + if(logfile) + fprintf(logfile, "FILE %s:%d fdopen(\"%d\",\"%s\") = %p\n", + source, line, filedes, mode, res); + return res; +} + int curl_fclose(FILE *file, int line, const char *source) { int res; Index: lib/memdebug.h =================================================================== RCS file: /cvsroot/curl/curl/lib/memdebug.h,v retrieving revision 1.33 diff -u -r1.33 memdebug.h --- lib/memdebug.h 27 Oct 2006 03:47:58 -0000 1.33 +++ lib/memdebug.h 28 Jun 2007 09:39:37 -0000 @@ -67,6 +67,8 @@ /* FILE functions */ CURL_EXTERN FILE *curl_fopen(const char *file, const char *mode, int line, const char *source); +CURL_EXTERN FILE *curl_fdopen(int filedes, const char *mode, int line, + const char *source); CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source); #ifndef MEMDEBUG_NODEFINES @@ -117,6 +119,8 @@ #undef fopen #define fopen(file,mode) curl_fopen(file,mode,__LINE__,__FILE__) +#undef fdopen +#define fdopen(file,mode) curl_fdopen(file,mode,__LINE__,__FILE__) #define fclose(file) curl_fclose(file,__LINE__,__FILE__) #endif /* MEMDEBUG_NODEFINES */ Index: tests/memanalyze.pl =================================================================== RCS file: /cvsroot/curl/curl/tests/memanalyze.pl,v retrieving revision 1.13 diff -u -r1.13 memanalyze.pl --- tests/memanalyze.pl 4 Aug 2005 23:05:36 -0000 1.13 +++ tests/memanalyze.pl 28 Jun 2007 09:39:37 -0000 @@ -237,7 +237,7 @@ $linenum = $2; $function = $3; - if($function =~ /fopen\(\"([^\"]*)\",\"([^\"]*)\"\) = (\(nil\)|0x([0-9a-f]*))/) { + if($function =~ /f[d]*open\(\"([^\"]*)\",\"([^\"]*)\"\) = (\(nil\)|0x([0-9a-f]*))/) { if($3 eq "(nil)") { ; }