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

index eb878a69ea4f5ccf2a95b8c6aa0ae6701b5d8ddb..cc9904ad30a197bae32cc4c47c0eeb6fa932de08 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