X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Finspect_fs_unix.c;h=00d3cd7d7a9e62763b68a2f22d330ecb57e297ff;hb=67030c6ef2b89ab98ed30d2ddc8a180c28395312;hp=a34d691ae8da0d945dfc1bba280e7214cb44d8a2;hpb=2b0ca7e7b8d369a42a51b1feec72ae8f17257c78;p=libguestfs.git diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c index a34d691..00d3cd7 100644 --- a/src/inspect_fs_unix.c +++ b/src/inspect_fs_unix.c @@ -29,9 +29,7 @@ #include #include -#ifdef HAVE_PCRE #include -#endif #ifdef HAVE_HIVEX #include @@ -46,7 +44,7 @@ #include "guestfs-internal-actions.h" #include "guestfs_protocol.h" -#if defined(HAVE_PCRE) && defined(HAVE_HIVEX) +#if defined(HAVE_HIVEX) /* Compile all the regular expressions once when the shared library is * loaded. PCRE is thread safe so we're supposedly OK here if @@ -406,6 +404,16 @@ guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs) if (guestfs___parse_major_minor (g, fs) == -1) return -1; } + else if (guestfs_exists (g, "/etc/ttylinux-target") > 0) { + fs->distro = OS_DISTRO_TTYLINUX; + + fs->product_name = guestfs___first_line_of_file (g, "/etc/ttylinux-target"); + if (fs->product_name == NULL) + return -1; + + if (guestfs___parse_major_minor (g, fs) == -1) + return -1; + } skip_release_checks:; @@ -545,11 +553,18 @@ check_hostname_redhat (guestfs_h *g, struct inspect_fs *fs) { char *hostname; + /* Errors here are not fatal (RHBZ#726739), since it could be + * just missing HOSTNAME field in the file. + */ + guestfs_error_handler_cb old_error_cb = g->error_cb; + g->error_cb = NULL; hostname = guestfs_aug_get (g, "/files/etc/sysconfig/network/HOSTNAME"); - if (!hostname) - return -1; + g->error_cb = old_error_cb; - fs->hostname = hostname; /* freed by guestfs___free_inspect_info */ + /* This is freed by guestfs___free_inspect_info. Note that hostname + * could be NULL because we ignored errors above. + */ + fs->hostname = hostname; return 0; } @@ -689,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); @@ -850,4 +868,4 @@ inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs, const char *filename, return r; } -#endif /* defined(HAVE_PCRE) && defined(HAVE_HIVEX) */ +#endif /* defined(HAVE_HIVEX) */