From fdeae81d81e979d74059f01350e94dbf37700075 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Sat, 4 Apr 2009 14:51:31 +0100 Subject: [PATCH] guest_add_{drive,cdrom} now test if the files exist. --- src/guestfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/guestfs.c b/src/guestfs.c index aa0aadb..3492c62 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -488,6 +488,11 @@ guestfs_add_drive (guestfs_h *g, const char *filename) return -1; } + if (access (filename, F_OK) == -1) { + perrorf (g, "%s", filename); + return -1; + } + snprintf (buf, len, "file=%s", filename); return guestfs_config (g, "-drive", buf); @@ -501,6 +506,11 @@ guestfs_add_cdrom (guestfs_h *g, const char *filename) return -1; } + if (access (filename, F_OK) == -1) { + perrorf (g, "%s", filename); + return -1; + } + return guestfs_config (g, "-cdrom", filename); } -- 1.8.3.1