[pve-devel] r4912 - qemu-server/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Jul 19 10:08:16 CEST 2010


Author: dietmar
Date: 2010-07-19 08:08:16 +0000 (Mon, 19 Jul 2010)
New Revision: 4912

Modified:
   qemu-server/trunk/ChangeLog
   qemu-server/trunk/QemuServer.pm
Log:
(change_config_nolock): remove tmp file if rename fails


Modified: qemu-server/trunk/ChangeLog
===================================================================
--- qemu-server/trunk/ChangeLog	2010-07-19 07:21:43 UTC (rev 4911)
+++ qemu-server/trunk/ChangeLog	2010-07-19 08:08:16 UTC (rev 4912)
@@ -2,6 +2,7 @@
 
 	* QemuServer.pm (change_config_nolock): carefully catch write
 	errors - avoid zero length config files when filesystem is full.
+	(change_config_nolock): remove tmp file if rename fails
 
 2010-06-29  Proxmox Support Team  <support at proxmox.com>
 

Modified: qemu-server/trunk/QemuServer.pm
===================================================================
--- qemu-server/trunk/QemuServer.pm	2010-07-19 07:21:43 UTC (rev 4911)
+++ qemu-server/trunk/QemuServer.pm	2010-07-19 08:08:16 UTC (rev 4912)
@@ -1085,7 +1085,11 @@
 	die $err;	
     }
 
-    rename $tmpfn, $filename || die "rename failed - $!\n";
+    if (!rename($tmpfn, $filename)) {
+	$err = "rename failed - $!\n";
+	unlink $tmpname;
+	die $err;
+    }
 }
 
 sub load_defaults { 




More information about the pve-devel mailing list