summaryrefslogtreecommitdiffstats
path: root/src/guestfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/guestfs.c')
-rw-r--r--src/guestfs.c10
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);
}