Merge branch 'master' of git+ssh://192.168.122.1/home/rjones/d/libguestfs
[libguestfs.git] / src / guestfs.c
index 5743a07..c3bce0b 100644 (file)
@@ -404,9 +404,11 @@ guestfs_error (guestfs_h *g, const char *fs, ...)
   char *msg;
 
   va_start (args, fs);
-  vasprintf (&msg, fs, args);
+  int err = vasprintf (&msg, fs, args);
   va_end (args);
 
+  if (err < 0) return;
+
   if (g->error_cb) g->error_cb (g, g->error_cb_data, msg);
   set_last_error (g, msg);
 
@@ -706,7 +708,7 @@ guestfs_add_drive (guestfs_h *g, const char *filename)
   }
 
   /* cache=off improves reliability in the event of a host crash. */
-  snprintf (buf, len, "file=%s,cache=off", filename);
+  snprintf (buf, len, "file=%s,cache=off,if=%s", filename, DRIVE_IF);
 
   return guestfs_config (g, "-drive", buf);
 }
@@ -727,7 +729,7 @@ guestfs_add_drive_ro (guestfs_h *g, const char *filename)
     return -1;
   }
 
-  snprintf (buf, len, "file=%s,snapshot=on", filename);
+  snprintf (buf, len, "file=%s,snapshot=on,if=%s", filename, DRIVE_IF);
 
   return guestfs_config (g, "-drive", buf);
 }
@@ -1471,6 +1473,13 @@ guestfs_free_lvm_lv_list (struct guestfs_lvm_lv_list *x)
   free (x);
 }
 
+void
+guestfs_free_dirent_list (struct guestfs_dirent_list *x)
+{
+  xdr_free ((xdrproc_t) xdr_guestfs_int_dirent_list, (char *) x);
+  free (x);
+}
+
 /* We don't know if stdout_event or sock_read_event will be the
  * first to receive EOF if the qemu process dies.  This function
  * has the common cleanup code for both.