[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xl: check for restore file open failure in create_domain



commit 77d8f863729f3b2d0eded2be5a230174ed4baff9
Author:     Matthew Daley <mattjd@xxxxxxxxx>
AuthorDate: Wed Oct 30 20:51:56 2013 +1300
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Oct 31 21:55:52 2013 +0000

    xl: check for restore file open failure in create_domain
    
    ...otherwise you get a less helpful error message.
    
    Coverity-ID: 1055569
    Signed-off-by: Matthew Daley <mattjd@xxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 43d1519..a935a18 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1919,6 +1919,10 @@ static uint32_t create_domain(struct domain_create 
*dom_info)
         } else {
             restore_source = restore_file;
             restore_fd = open(restore_file, O_RDONLY);
+            if (restore_fd == -1) {
+                fprintf(stderr, "Can't open restore file: %s\n", 
strerror(errno));
+                return ERROR_INVAL;
+            }
             rc = libxl_fd_set_cloexec(ctx, restore_fd, 1);
             if (rc) return rc;
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.