From bd5aac0e2eae2dd73c35b6bbb2e79ef48c98ca21 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Mon, 2 Mar 2009 12:45:48 -0500 Subject: [PATCH] fix remove_monkeysphere_line function to properly handle empty files. --- src/share/common | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/share/common b/src/share/common index 83f2d6f..83120d1 100644 --- a/src/share/common +++ b/src/share/common @@ -354,12 +354,15 @@ remove_monkeysphere_lines() { file="$1" - if [ -z "$file" ] ; then + # return error if file does not exist + if [ ! -e "$file" ] ; then return 1 fi - if [ ! -e "$file" ] ; then - return 1 + # just return ok if the file is empty, since there aren't any + # lines to remove + if [ ! -s "$file" ] ; then + return 0 fi tempfile=$(mktemp "${file}.XXXXXXX") || \ -- 2.26.2