Преглед изворни кода

Making sure chmod and chown does not follow symlinks

Anton Reutov пре 4 година
родитељ
комит
93eec18723
1 измењених фајлова са 12 додато и 0 уклоњено
  1. 12 0
      func/main.sh

+ 12 - 0
func/main.sh

@@ -954,3 +954,15 @@ format_aliases() {
         aliases=$(echo "$aliases" |tr '\n' ',' |sed -e "s/,$//")
     fi
 }
+
+# Simple chmod wrapper that skips symlink files after glob expand
+# Taken from HestiaCP
+no_symlink_chmod() {
+    local filemode=$1; shift;
+
+    for i in "$@"; do
+        [[ -L ${i} ]] && continue
+
+        chmod "${filemode}" "${i}"
+    done
+}