summaryrefslogtreecommitdiff
path: root/src/share/common
diff options
context:
space:
mode:
authorJameson Rollins <jrollins@finestructure.net>2010-10-19 00:00:17 -0400
committerJameson Rollins <jrollins@finestructure.net>2010-10-19 00:00:17 -0400
commiteed88e101708058baa6656380b68f826340eb76a (patch)
tree2f123400749300bf77d6888b48b9977d41b4401d /src/share/common
parent2072a06faaf49615a75ef216b296abfbf14e1262 (diff)
fix remove_line function to not use fixed string checking, and to mv -f the tmp file into place
Diffstat (limited to 'src/share/common')
-rw-r--r--src/share/common7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/share/common b/src/share/common
index 8c21a83..d286145 100644
--- a/src/share/common
+++ b/src/share/common
@@ -340,14 +340,13 @@ remove_line() {
fi
# if the string is in the file...
- if grep -q -F "$string" "$file" 2>/dev/null ; then
+ if grep "$string" "$file" &>/dev/null ; then
tempfile=$(mktemp "${file}.XXXXXXX") || \
failure "Unable to make temp file '${file}.XXXXXXX'"
# remove the line with the string, and return 0
- grep -v -F "$string" "$file" >"$tempfile"
- cat "$tempfile" > "$file"
- rm "$tempfile"
+ grep -v "$string" "$file" >"$tempfile"
+ mv -f "$tempfile" "$file"
return 0
# otherwise return 1
else