fix remove_monkeysphere_line function to properly handle empty files.
authorJameson Graef Rollins <jrollins@finestructure.net>
Mon, 2 Mar 2009 17:45:48 +0000 (12:45 -0500)
committerJameson Graef Rollins <jrollins@finestructure.net>
Mon, 2 Mar 2009 17:45:48 +0000 (12:45 -0500)
src/share/common

index 83f2d6f0387ce8da484e327349ad09a498c2a9bf..83120d120c785e11cf9ab291852eea3eafe0db84 100644 (file)
@@ -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") || \