Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9483 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23046 invoked by uid 1010); 22 Apr 2004 09:51:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 23022 invoked from network); 22 Apr 2004 09:51:29 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by pb1.pair.com with SMTP; 22 Apr 2004 09:51:29 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i3M9pSFe001160; Thu, 22 Apr 2004 05:51:28 -0400 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i3M9pRp24810; Thu, 22 Apr 2004 05:51:27 -0400 Received: from radish.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by radish.cambridge.redhat.com (8.12.10/8.12.7) with ESMTP id i3M9pQc3023883; Thu, 22 Apr 2004 10:51:27 +0100 Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.12.10/8.12.10/Submit) id i3M9pPqN023882; Thu, 22 Apr 2004 10:51:25 +0100 Date: Thu, 22 Apr 2004 10:51:25 +0100 To: Bret Hughes Cc: php internals Message-ID: <20040422095125.GA23874@redhat.com> Mail-Followup-To: Bret Hughes , php internals References: <1082606512.2791.204.camel@bretsony> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1082606512.2791.204.camel@bretsony> User-Agent: Mutt/1.4.1i Subject: Re: [PHP-DEV] umask weirdness From: jorton@redhat.com (Joe Orton) 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;