---
src/copy-in-out.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/copy-in-out.c b/src/copy-in-out.c
index d5e7fb0..89344d8 100644
--- a/src/copy-in-out.c
+++ b/src/copy-in-out.c
@@ -46,6 +46,12 @@ guestfs_impl_copy_in (guestfs_h *g,
size_t buf_len = strlen (localpath) + 1;
char buf[buf_len];
const char *dirname, *basename;
+ struct stat statbuf;
+
+ if (stat (localpath, &statbuf) == -1) {
+ error (g, _("source '%s' does not exist (or cannot be read)"),
localpath);
+ return -1;
+ }
int remote_is_dir = guestfs_is_dir (g, remotedir);
if (remote_is_dir == -1)
--
2.1.0