X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Finspect_fs_unix.c;h=fcc907bd26848919bbcfa60ea316a7c2dd28e3be;hb=8375d3032eeba790106f95d9a59c0f624d7b550b;hp=a34d691ae8da0d945dfc1bba280e7214cb44d8a2;hpb=ef9f82e16c979a8a34ddb9514dc7ac70a989141a;p=libguestfs.git diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c index a34d691..fcc907b 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; }