diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-04 14:51:31 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-04 14:51:31 +0100 |
commit | fdeae81d81e979d74059f01350e94dbf37700075 (patch) | |
tree | d36f87c7762d66983d89a9a2792a1b54cb3da2c4 /src/guestfs.c | |
parent | f0624da341ceadf637c700fa91727707bd44b41a (diff) | |
download | libguestfs-fdeae81d81e979d74059f01350e94dbf37700075.tar.gz libguestfs-fdeae81d81e979d74059f01350e94dbf37700075.tar.xz libguestfs-fdeae81d81e979d74059f01350e94dbf37700075.zip |
guest_add_{drive,cdrom} now test if the files exist.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r-- | src/guestfs.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c index aa0aadbf..3492c624 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); } |