Buffer file before modifying it

This commit is contained in:
Salt 2024-12-01 23:21:43 -06:00
parent 1dee476771
commit 5730d3c060

View File

@ -111,5 +111,7 @@ for file in /etc/shadow /etc/gshadow; do
"/^$name:/d" \
"$file"
fi
done < "$file"
# Not useless use of cat. We're buffering the file here to avoid conditions
# where we edit the file we're reading and face issues.
done < <(cat "$file")
done