Przeglądaj źródła

Making sure chmod and chown does not follow symlinks

Anton Reutov 4 lat temu
rodzic
commit
93eec18723
1 zmienionych plików z 12 dodań i 0 usunięć
  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
+}