Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:17554 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87419 invoked by uid 1010); 5 Aug 2005 21:02:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 87404 invoked from network); 5 Aug 2005 21:02:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Aug 2005 21:02:04 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:36034] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 09/FC-04646-BC3D3F24 for ; Fri, 05 Aug 2005 17:02:04 -0400 Received: (qmail 32557 invoked from network); 5 Aug 2005 21:02:47 -0000 Received: from internal.zend.office (HELO localhost) (10.1.1.1) by internal.zend.office with SMTP; 5 Aug 2005 21:02:47 -0000 Date: Sat, 6 Aug 2005 01:01:53 +0400 To: Rob Richards Cc: internals@lists.php.net Message-ID: <20050806010153.15db58be.antony@zend.com> In-Reply-To: <42F3D095.8010604@ctindustries.net> References: <42F3D095.8010604@ctindustries.net> X-Mailer: Sylpheed version 2.0.0 (GTK+ 2.6.4; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Questions on stream From: antony@zend.com (Antony Dovgal) On Fri, 05 Aug 2005 16:48:21 -0400 Rob Richards wrote: > I was wondering if the following are bugs or expected behavior/wont change. > > Take the following code: > $handle = fopen("file.txt", "w"); > fwrite($handle, "SOME DATA"); > unlink("file.txt"); > if (fwrite($handle, "SOMEMORE") === FALSE) { > print "CANNOT WRITE"; > } else { > print "Wrote Data"; > } > fclose($handle); > ?> > > Under linux the file is deleted and the result is Wrote Data (even > though the last fwrite didnt do anything). That's because on Linux data gets phisically deleted only when number of hardlinks to it and number of open descriptors becomes 0. It's perfectly fine to open & delete file and continue writing to/reading from it. That's, btw, one of the well known methods used do get a temporary FD. > Under windows, the unlink() call results in a permissions denied error. Yup =) Also on Windows you can't open a file already opened by someone. > Shouldn't linux not allow the file to be deleted with an open stream as > well? No, why? -- Wbr, Antony Dovgal