libxl: only close fds which successfully opened in libxl__spawn_local_dm
authorMatthew Daley <mattjd@gmail.com>
Wed, 30 Oct 2013 07:51:54 +0000 (20:51 +1300)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 31 Oct 2013 21:55:52 +0000 (21:55 +0000)
Coverity-ID: 1055565
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl_dm.c

index ef29d0b025d674db8cd7aec8ad2bb0419f9861b5..24eebda03f2d8bfcc76ae37c07c518a872e270d0 100644 (file)
@@ -1259,8 +1259,8 @@ retry_transaction:
     rc = 0;
 
 out_close:
-    close(null);
-    close(logfile_w);
+    if (null != -1) close(null);
+    if (logfile_w != -1) close(logfile_w);
 out:
     if (rc)
         device_model_spawn_outcome(egc, dmss, rc);