X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Finspect.c;fp=src%2Finspect.c;h=ec1a2a0b3d753d25549ecb0f8197f077a6045605;hb=677453aef14d0f8a06e574e9d78ca21f322b8c18;hp=e7408b692704609cf1007b2e6001c313cbb69c41;hpb=7ad3300b406f7b0cc7c69adfe16a6565a6e70f1c;p=libguestfs.git diff --git a/src/inspect.c b/src/inspect.c index e7408b6..ec1a2a0 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -757,11 +757,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; }