svn: /phpdoc/en/trunk/reference/filesystem/functions/ flock.xml
| From: | Jakub Vrana | Date: | Mon, 16 Nov 2009 11:19:59 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/filesystem/functions/ flock.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-5390@lists.php.net to get a copy of this message | ||
vrana Mon, 16 Nov 2009 11:19:59 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=290804
Log:
Fix example (bug #50177)
Bug: http://bugs.php.net/50177 (Closed) flock: Example 1 -
file is truncated twice
Changed paths:
U phpdoc/en/trunk/reference/filesystem/functions/flock.xml
Modified: phpdoc/en/trunk/reference/filesystem/functions/flock.xml
===================================================================
--- phpdoc/en/trunk/reference/filesystem/functions/flock.xml 2009-11-16 10:36:27 UTC (rev 290803)
+++ phpdoc/en/trunk/reference/filesystem/functions/flock.xml 2009-11-16 11:19:59 UTC (rev 290804)
@@ -132,10 +132,10 @@
<![CDATA[
<?php
-$fp = fopen("/tmp/lock.txt", "w");
+$fp = fopen("/tmp/lock.txt", "r+");
if (flock($fp, LOCK_EX)) { // do an exclusive lock
- ftruncate($fp, 0); // truncate file
+ ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
flock($fp, LOCK_UN); // release the lock
} else {