From eed88e101708058baa6656380b68f826340eb76a Mon Sep 17 00:00:00 2001 From: Jameson Rollins Date: Tue, 19 Oct 2010 00:00:17 -0400 Subject: fix remove_line function to not use fixed string checking, and to mv -f the tmp file into place --- src/share/common | 7 +++---- 1 file 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 -- cgit v1.2.3