From 3fa995bb29df7969c473fe1d81ccbbc3ef08765d Mon Sep 17 00:00:00 2001 From: Mark Buechler Date: Fri, 11 Jan 2013 17:59:51 +0000 Subject: [PATCH] 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 --- scstadmin/scstadmin.sysfs/scstadmin | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/scstadmin/scstadmin.sysfs/scstadmin b/scstadmin/scstadmin.sysfs/scstadmin index b324755c1..464ee3af5 100755 --- a/scstadmin/scstadmin.sysfs/scstadmin +++ b/scstadmin/scstadmin.sysfs/scstadmin @@ -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";