Truncate config file instead of deleting it before writing.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4728 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Mark Buechler
2013-01-11 17:59:51 +00:00
parent 9226ba652c
commit 3fa995bb29

View File

@@ -1330,15 +1330,7 @@ sub serializeNkAttr {
sub writeConfiguration {
my $nonkey = shift;
if (-f $CONFIGFILE) {
if (!unlink $CONFIGFILE) {
print "Failed to save current configuration, specified ".
"file exists and cannot be deleted.\n";
return 1;
}
}
my $io = new IO::File $CONFIGFILE, O_CREAT|O_WRONLY;
my $io = new IO::File $CONFIGFILE, O_CREAT|O_WRONLY|O_TRUNC;
if (!$io) {
print "Failed to save configuration to file '$CONFIGFILE': $!\n";