CVS update: php3/functions

From: Date: Tue, 25 Aug 1998 18:49:09 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-570@lists.php.net to get a copy of this message
Date: Tuesday August 25, 1998 @ 14:49 Author: rasmus Update of /repository/php3/functions In directory asf:/export/home/rasmus/php3/functions Modified Files: file.c mime.c Log Message: Delete uploaded temporary files automatically at the end of a request Index: php3/functions/file.c diff -c php3/functions/file.c:1.175 php3/functions/file.c:1.176 *** php3/functions/file.c:1.175 Wed Aug 12 11:05:15 1998 --- php3/functions/file.c Tue Aug 25 14:49:05 1998 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 1.175 1998/08/12 15:05:15 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 1.176 1998/08/25 18:49:05 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 80,85 **** --- 80,86 ---- int le_fp,le_pp; int wsa_fp; /*to handle reading and writing to windows sockets*/ static int pclose_ret; + extern int le_uploads; #endif #ifndef HAVE_TEMPNAM *************** *** 292,297 **** --- 293,303 ---- } } + static void _php3_unlink_uploaded_file(char *file) { + if(file) { + unlink(file); + } + } int php3_minit_file(INIT_FUNC_ARGS) { *************** *** 300,305 **** --- 306,312 ---- GLOBAL(le_fp) = register_list_destructors(fclose,NULL); GLOBAL(le_pp) = register_list_destructors(__pclose,NULL); GLOBAL(wsa_fp) = register_list_destructors(_php3_closesocket,NULL); + GLOBAL(le_uploads) = register_list_destructors(_php3_unlink_uploaded_file,NULL); return SUCCESS; } Index: php3/functions/mime.c diff -c php3/functions/mime.c:1.52 php3/functions/mime.c:1.53 *** php3/functions/mime.c:1.52 Fri May 15 06:57:27 1998 --- php3/functions/mime.c Tue Aug 25 14:49:08 1998 *************** *** 23,33 **** | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Rasmus Lerdorf | ! | | +----------------------------------------------------------------------+ */ ! /* $Id: mime.c,v 1.52 1998/05/15 10:57:27 zeev Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 23,32 ---- | If you did not, or have any questions about PHP licensing, please | | contact core@php.net. | +----------------------------------------------------------------------+ ! | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: mime.c,v 1.53 1998/08/25 18:49:08 rasmus Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 37,43 **** --- 36,47 ---- #include "type.h" #include "post.h" #include "mime.h" + #include "php3_list.h" + #ifndef THREAD_SAFE + int le_uploads; + extern HashTable list; + #endif #define NEW_BOUNDARY_CHECK 1 #define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; } *************** *** 207,212 **** --- 211,217 ---- } bytes = fwrite(ptr, 1, loc - ptr - 4, fp); fclose(fp); + php3_list_do_insert(&GLOBAL(list),fn,GLOBAL(le_uploads)); /* Tell PHP about the file so the destructor can unlink it later */ if (bytes < (loc - ptr - 4)) { php3_error(E_WARNING, "Only %d bytes were written, expected to write %ld", bytes, loc - ptr - 4); } -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#570) next »