Re: cvs: php4 /ext/curl curl.c

From: Date: Mon, 04 Dec 2000 03:23:33 +0000
Subject: Re: cvs: php4 /ext/curl curl.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2928@lists.php.net to get a copy of this message
Can some one pls commit this to the release tree? Thanks, Sterling > sterling Mon Dec 4 07:05:24 2000 EDT > > Modified files: > /php4/ext/curl curl.c > Log: > close the filehandle if it is a tempfile. > > > > Index: php4/ext/curl/curl.c > diff -u php4/ext/curl/curl.c:1.29 php4/ext/curl/curl.c:1.30 > --- php4/ext/curl/curl.c:1.29 Thu Nov 23 08:31:58 2000 > +++ php4/ext/curl/curl.c Mon Dec 4 07:05:23 2000 > @@ -16,7 +16,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: curl.c,v 1.29 2000/11/23 16:31:58 sniper Exp $ */ > +/* $Id: curl.c,v 1.30 2000/12/04 15:05:23 sterling Exp $ */ > > > #include "php.h" > @@ -300,7 +300,7 @@ > } > memset(curl_handle, 0, sizeof(php_curl)); > > - zend_llist_init(&curl_handle->to_free,sizeof(char *),curl_free_string,0); > + zend_llist_init(&curl_handle->to_free, sizeof(char *), curl_free_string, 0); > > curl_handle->cp = curl_easy_init(); > if (!curl_handle->cp) { > @@ -576,7 +576,8 @@ > CURLcode ret; > FILE *fp; > char buf[4096]; > - int b; > + int b, > + is_temp_file; > unsigned long pos = 0; > > if (ZEND_NUM_ARGS() != 1 || > @@ -595,6 +596,8 @@ > } > > curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp); > + > + is_temp_file = 1; > > } else if (curl_handle->return_transfer && > curl_handle->output_file) { > @@ -614,6 +617,9 @@ > } else { > RETURN_TRUE; > } > + > + if (fp && is_temp_file) > + fclose(fp); > > } > > @@ -625,6 +631,9 @@ > php_write(buf, b); > } > > + if (is_temp_file) > + fclose(fp); > + > } else { > > char *ret_data; > @@ -641,6 +650,9 @@ > pos += b; > } > ret_data[stat_sb.st_size - 1] = '\0'; > + > + if (is_temp_file) > + fclose(fp); > > RETURN_STRINGL(ret_data, stat_sb.st_size, 0); > > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net > For additional commands, e-mail: php-cvs-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.cvs (#2928) next »