Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9497 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84285 invoked by uid 1010); 23 Apr 2004 13:59:34 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84237 invoked from network); 23 Apr 2004 13:59:33 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 23 Apr 2004 13:59:33 -0000 Received: (qmail 8188 invoked from network); 23 Apr 2004 13:59:32 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 23 Apr 2004 13:59:32 -0000 Message-ID: <5.1.0.14.2.20040423165806.01fde858@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Fri, 23 Apr 2004 16:59:27 +0300 To: Joe Orton ,Bret Hughes Cc: php internals In-Reply-To: <20040422095125.GA23874@redhat.com> References: <1082606512.2791.204.camel@bretsony> <1082606512.2791.204.camel@bretsony> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] umask weirdness From: andi@zend.com (Andi Gutmans) If at all, I think this should be fixed in PHP so that it affects all SAPIs (i.e. first time we set umask() save the old one and a flag that let's RSHUTDOWN know it should change it back). Andi At 10:51 AM 4/22/2004 +0100, Joe Orton wrote: >Patch is below; the apache2filter SAPI needs the same fix. This >"feature" of resetting the umask across requests is pretty dubious if >used with a threaded MPM, however, since the umask is a process >attribute not a thread attribute. > >--- php-4.3.6/sapi/apache2handler/sapi_apache2.c.umask >+++ php-4.3.6/sapi/apache2handler/sapi_apache2.c >@@ -420,6 +420,19 @@ > return APR_SUCCESS; > } > >+static int saved_umask; >+ >+static void php_save_umask(void) >+{ >+ saved_umask = umask(0777); >+ umask(saved_umask); >+} >+ >+static void php_restore_umask(void) >+{ >+ umask(saved_umask); >+} >+ > static void php_apache_request_ctor(request_rec *r, php_struct *ctx > TSRMLS_DC) > { > char *content_type; >@@ -552,6 +565,8 @@ > } else { > zend_file_handle zfd = {0}; > >+ php_save_umask(); >+ > zfd.type = ZEND_HANDLE_FILENAME; > zfd.filename = (char *) r->filename; > zfd.free_filename = 0; >@@ -562,6 +577,9 @@ > } else { > zend_execute_scripts(ZEND_INCLUDE TSRMLS_CC, > NULL, 1, &zfd); > } >+ >+ php_restore_umask(); >+ > #if MEMORY_LIMIT > { > char *mem_usage; > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php