From: Richard W.M. Jones <rjones@redhat.com>
Date: Fri, 16 Sep 2011 14:26:20 +0000 (+0100)
Subject: inspection: Handle /dev/root in /etc/fstab.
X-Git-Tag: 1.13.13~2
X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=917f947590c92318fee2545ba88245d0de012e31;p=libguestfs.git

inspection: Handle /dev/root in /etc/fstab.

This means "the device that holds /etc/fstab", so map it correctly.

This fixes support for ttylinux and also some other guests that use
/dev/root instead of a real device name.
---

diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c
index 4270712..00d3cd7 100644
--- a/src/inspect_fs_unix.c
+++ b/src/inspect_fs_unix.c
@@ -704,6 +704,9 @@ add_fstab_entry (guestfs_h *g, struct inspect_fs *fs,
   else if (STRPREFIX (spec, "LABEL="))
     device = guestfs_findfs_label (g, &spec[6]);
   /* Ignore "/.swap" (Pardus) and pseudo-devices like "tmpfs". */
+  else if (STREQ (spec, "/dev/root"))
+    /* Resolve /dev/root to the current device. */
+    device = safe_strdup (g, fs->device);
   else if (STRPREFIX (spec, "/dev/"))
     /* Resolve guest block device names. */
     device = resolve_fstab_device (g, spec);