]> granicus.if.org Git - php/commitdiff
fix test : skip if user is root
authorRaghubansh Kumar <kraghuba@php.net>
Mon, 20 Aug 2007 04:07:02 +0000 (04:07 +0000)
committerRaghubansh Kumar <kraghuba@php.net>
Mon, 20 Aug 2007 04:07:02 +0000 (04:07 +0000)
ext/standard/tests/file/unlink_variation1.phpt

index da0b01957ed34c9114bcb927b8f6fe8657bf5f87..4046be88207607555c1596f56850501c15567d6e 100644 (file)
@@ -5,6 +5,16 @@ Test unlink() function : usage variations - unlinking file in a directory
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip only on Linux');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$filename = dirname(__FILE__)."/unlink_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip...cannot be run as root\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php