appliance: udev-174 moves udevd to /lib/udev/udevd (instead of /sbin/udevd)
[libguestfs.git] / inspector / virt-inspector.c
index ee7c9c3..2e3449e 100644 (file)
@@ -23,6 +23,7 @@
 #include <inttypes.h>
 #include <unistd.h>
 #include <getopt.h>
+#include <locale.h>
 #include <assert.h>
 
 #include <libxml/xmlIO.h>
@@ -118,11 +119,9 @@ main (int argc, char *argv[])
   };
   struct drv *drvs = NULL;
   struct drv *drv;
-  char *p, *file = NULL;
   const char *format = NULL;
   int c;
   int option_index;
-  int next_prepared_drive = 1;
 
   g = guestfs_create ();
   if (g == NULL) {
@@ -409,6 +408,14 @@ output_root (xmlTextWriterPtr xo, char *root)
     free (str);
   );
 
+  str = guestfs_inspect_get_hostname (g, root);
+  if (!str) exit (EXIT_FAILURE);
+  if (STRNEQ (str, "unknown"))
+    XMLERROR (-1,
+      xmlTextWriterWriteElement (xo, BAD_CAST "hostname",
+                                 BAD_CAST str));
+  free (str);
+
   output_mountpoints (xo, root);
 
   output_filesystems (xo, root);