cvs: phpdoc /en/reference/filesystem/functions flock.xml
| From: | Rasmus Lerdorf | Date: | Wed, 01 Jul 2009 20:15:16 +0000 |
| Subject: | cvs: phpdoc /en/reference/filesystem/functions flock.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-4306@lists.php.net to get a copy of this message | ||
rasmus Wed Jul 1 20:15:16 2009 UTC
Modified files:
/phpdoc/en/reference/filesystem/functions flock.xml
Log:
Don't use w+ in the example here
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/filesystem/functions/flock.xml?r1=1.17&r2=1.18&diff_format=u
Index: phpdoc/en/reference/filesystem/functions/flock.xml
diff -u phpdoc/en/reference/filesystem/functions/flock.xml:1.17
phpdoc/en/reference/filesystem/functions/flock.xml:1.18
--- phpdoc/en/reference/filesystem/functions/flock.xml:1.17 Thu Aug 16 13:46:21 2007
+++ phpdoc/en/reference/filesystem/functions/flock.xml Wed Jul 1 20:15:16 2009
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.17 $ -->
+<!-- $Revision: 1.18 $ -->
<refentry xmlns="http://docbook.org/ns/docbook"
xml:id="function.flock">
<refnamediv>
<refname>flock</refname>
@@ -130,13 +130,14 @@
<![CDATA[
<?php
-$fp = fopen("/tmp/lock.txt", "w+");
+$fp = fopen("/tmp/lock.txt", "w");
if (flock($fp, LOCK_EX)) { // do an exclusive lock
+ ftruncate($fp, 0); // truncate file
fwrite($fp, "Write something here\n");
flock($fp, LOCK_UN); // release the lock
} else {
- echo "Couldn't lock the file !";
+ echo "Couldn't get the lock!";
}
fclose($fp);