From: Richard Jones Date: Sat, 4 Apr 2009 13:51:31 +0000 (+0100) Subject: guest_add_{drive,cdrom} now test if the files exist. X-Git-Tag: 0.4~12 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=fdeae81d81e979d74059f01350e94dbf37700075;hp=f0624da341ceadf637c700fa91727707bd44b41a;p=libguestfs.git guest_add_{drive,cdrom} now test if the files exist. --- 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); }