diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-07-29 17:38:43 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-08-07 21:59:39 +0100 |
commit | 650cd79f54ee42523a517fdbf19b170803d422f5 (patch) | |
tree | 075fc66ff3e9fd42f6532d4e737de4e2bd7c4d77 /src | |
parent | dc186082b12416e7f53ca7542e7363842cc779ff (diff) | |
download | libguestfs-650cd79f54ee42523a517fdbf19b170803d422f5.tar.gz libguestfs-650cd79f54ee42523a517fdbf19b170803d422f5.tar.xz libguestfs-650cd79f54ee42523a517fdbf19b170803d422f5.zip |
Don't fail if HOSTNAME field is missing on Red Hat guests (RHBZ#726739).
(cherry picked from commit bad3f4b54a959685f3c0697238fc5753096834fb)
Diffstat (limited to 'src')
-rw-r--r-- | src/inspect_fs_unix.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c index a34d691a..fcc907bd 100644 --- a/src/inspect_fs_unix.c +++ b/src/inspect_fs_unix.c @@ -545,11 +545,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; } |