git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ruby: Check Ruby callback exists before we call it (RHBZ#733297).
[libguestfs.git]
/
src
/
inspect_fs_unix.c
diff --git
a/src/inspect_fs_unix.c
b/src/inspect_fs_unix.c
index
a34d691
..
b8be049
100644
(file)
--- a/
src/inspect_fs_unix.c
+++ b/
src/inspect_fs_unix.c
@@
-29,9
+29,7
@@
#include <errno.h>
#include <endian.h>
#include <errno.h>
#include <endian.h>
-#ifdef HAVE_PCRE
#include <pcre.h>
#include <pcre.h>
-#endif
#ifdef HAVE_HIVEX
#include <hivex.h>
#ifdef HAVE_HIVEX
#include <hivex.h>
@@
-46,7
+44,7
@@
#include "guestfs-internal-actions.h"
#include "guestfs_protocol.h"
#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
/* Compile all the regular expressions once when the shared library is
* loaded. PCRE is thread safe so we're supposedly OK here if
@@
-545,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;
}
@@
-850,4
+855,4
@@
inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs, const char *filename,
return r;
}
return r;
}
-#endif /* defined(HAVE_
PCRE) && defined(HAVE_
HIVEX) */
+#endif /* defined(HAVE_HIVEX) */