From: Matthew Daley Date: Wed, 30 Oct 2013 07:51:56 +0000 (+1300) Subject: xl: check for restore file open failure in create_domain X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6097 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=77d8f863729f3b2d0eded2be5a230174ed4baff9;p=xen.git 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 Reviewed-by: Andrew Cooper Acked-by: Ian Campbell --- diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 43d15190e2..a935a18cb4 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; }