OSDN Git Service

On HP-UX 11.23, "chmod -R" cannot change the file permission in non-writable and...
authorKoji Arai <jca02266@gmail.com>
Thu, 30 Oct 2008 06:11:55 +0000 (15:11 +0900)
committerKoji Arai <jca02266@gmail.com>
Thu, 30 Oct 2008 13:27:17 +0000 (22:27 +0900)
tests/lha-test.in

index 7870847..a809b20 100644 (file)
@@ -81,10 +81,22 @@ check()
   fi
 }
 
+# On HP-UX 11.23, "chmod -R" cannot change the file permission in
+# non-writable and non-executable directory.
+chmod_R()
+{
+  typeset mode="$1"; shift
+  for x in "$@"
+  do
+    chmod $mode "$x"
+    test -d "$x" && (cd "$x" && chmod_R $mode *)
+  done
+}
+
 cleanup()
 {
   if [[ x$no_cleanup = x ]]; then
-    chmod -R 755 test-tmp* 2>/dev/null
+    chmod_R 755 test-tmp* 2>/dev/null
     rm -rf test-tmp*
   fi
 }