summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authorschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-11-21 04:26:29 +0000
committerschnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac>2005-11-21 04:26:29 +0000
commit8067154285e2db16b977dfc3a5296a85f7ca2e0b (patch)
tree7411d50cc38e4f731fc355616d00a82ec7bd297b /lib/sbin
parent2c8b631ff1123c95fd47e14e074f7732285723fe (diff)
Handle empty files correctly in WriteFile. Before, the existing file
was left untouched if the new content was empty. This meant that empty files were never generated, and existing non-empty files were never made empty. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4198 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/CSTUtils.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sbin/CSTUtils.pl b/lib/sbin/CSTUtils.pl
index e6c9abde..63bd7431 100644
--- a/lib/sbin/CSTUtils.pl
+++ b/lib/sbin/CSTUtils.pl
@@ -172,8 +172,11 @@ sub WriteFile
$filename =~ s/^\s*\"(.*)\"\s*$/\1/;
$filename =~ s/^\s*\'(.*)\'\s*$/\1/;
+# Set this to an illegal value,
+# so that the comparison later is guaranteed to fail if this is not changed
+ $data_in = undefined;
+
# Read in file
- $data_in = "";
if (-e $filename)
{
# only read the file if it its size equals the length of the rdata string