On Fri, 05 Aug 2005 16:48:21 -0400 Rob Richards <[EMAIL PROTECTED]> wrote:
> I was wondering if the following are bugs or expected behavior/wont change. > > Take the following code: > <?php > $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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php