git.annexia.org
/
libguestfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c70532a
)
Don't fail if HOSTNAME field is missing on Red Hat guests (RHBZ#726739).
author
Richard W.M. Jones
<rjones@redhat.com>
Fri, 29 Jul 2011 16:38:43 +0000
(17:38 +0100)
committer
Richard W.M. Jones
<rjones@redhat.com>
Fri, 29 Jul 2011 16:38:43 +0000
(17:38 +0100)
src/inspect_fs_unix.c
patch
|
blob
|
history
diff --git
a/src/inspect_fs_unix.c
b/src/inspect_fs_unix.c
index
2ea29ad
..
b8be049
100644
(file)
--- a/
src/inspect_fs_unix.c
+++ b/
src/inspect_fs_unix.c
@@
-543,11
+543,18
@@
check_hostname_redhat (guestfs_h *g, struct inspect_fs *fs)
{
char *hostname;
{
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");
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;
}
return 0;
}