From: Sebastian Harl Date: Tue, 5 Mar 2013 01:11:13 +0000 (+0100) Subject: Merged branch 'master' of git://git.tokkee.org/sysdb.git. X-Git-Tag: sysdb-0.1.0~438 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=1905dca54fb53caed8171da2fcb842afc9f33216;hp=939bfe506b177cab5867a3a389d44a744802f77b Merged branch 'master' of git://git.tokkee.org/sysdb.git. --- diff --git a/README b/README index 55a8be8..56dde37 100644 --- a/README +++ b/README @@ -19,9 +19,13 @@ Prerequisites * A build environment: autotools, libtool, C compiler, ... + * When building from Git, you also need the flex lexical analyzer generator + and bison parser generator (other lex and yacc compatible tools might work + as well if you are lucky). + * A POSIX + Single UNIX Specification compatible C library. - * asciidoc, xsltproc: + * asciidoc, xsltproc, xmlto: The AsciiDoc text document format is used to write the manpages. Configuring / Compiling / Installing diff --git a/configure.ac b/configure.ac index fac681d..dfcb64f 100644 --- a/configure.ac +++ b/configure.ac @@ -171,8 +171,7 @@ if test "x$enable_strict_checks" = "xyes"; then -Wmissing-prototypes \ -Wpointer-arith \ -Wshadow \ - -Wstrict-prototypes \ - -Wunreachable-code; do + -Wstrict-prototypes; do AC_MSG_CHECKING([whether $CC accepts $flag]) if test_cc_flags $flag; then @@ -207,6 +206,13 @@ AM_CONDITIONAL([BUILD_WITH_LIBDBI], test "x$with_libdbi" = "xyes") dnl Feature checks. build_documentation="yes" +have_xmlto="yes" +AC_PATH_PROG([XMLTO], [xmlto]) +if test "x$XMLTO" = "x"; then + have_xmlto="no" + build_documentation="no (missing xmlto)" +fi + have_xsltproc="yes" AC_PATH_PROG([XSLTPROC], [xsltproc]) if test "x$XSLTPROC" = "x"; then @@ -223,9 +229,9 @@ fi AC_SUBST([A2X]) dnl Plugin checks. -enable_puppet_storeconfigs=$with_libdbi -if test "x$enable_puppet_storeconfigs" = "xno"; then - enable_puppet_storeconfigs="no (requires libdbi)" +puppet_storeconfigs_default=$with_libdbi +if test "x$puppet_storeconfigs_default" != "xyes"; then + puppet_storeconfigs_default="no (requires libdbi)" fi m4_divert_once([HELP_ENABLE], [ @@ -236,7 +242,7 @@ AC_SDB_PLUGIN([collectd], [yes], [backend accessing the system statistics collection daemon]) AC_SDB_PLUGIN([mk-livestatus], [yes], [backend accessing Nagios/Icinga/Shinken using MK Livestatus]) -AC_SDB_PLUGIN([puppet-storeconfigs], [$enable_puppet_storeconfigs], +AC_SDB_PLUGIN([puppet-storeconfigs], [$puppet_storeconfigs_default], [backend accessing the Puppet stored configuration database]) AM_CONDITIONAL([BUILD_DOCUMENTATION], test "x$build_documentation" = "xyes") @@ -260,7 +266,7 @@ AC_MSG_RESULT([ build date: $BUILD_DATE]) AC_MSG_RESULT() AC_MSG_RESULT([ Tools:]) AC_MSG_RESULT([ AsciiDoc (a2x): . . . . . . $have_a2x]) -AC_MSG_RESULT([ xsltproc: . . . . . . . . . $have_xsltproc]) +AC_MSG_RESULT([ xmlto / xsltproc: . . . . . $have_xmlto / $have_xsltproc]) AC_MSG_RESULT() AC_MSG_RESULT([ Features:]) AC_MSG_RESULT([ documentation: . . . . . . $build_documentation]) diff --git a/m4/sdb_plugin.m4 b/m4/sdb_plugin.m4 index 1cf916c..e734e0d 100644 --- a/m4/sdb_plugin.m4 +++ b/m4/sdb_plugin.m4 @@ -60,7 +60,7 @@ AC_DEFUN([AC_SDB_PLUGIN], if test "x$2" = "xyes"; then enable_plugin="yes" else - enable_plugin="no" + enable_plugin="$2" fi else enable_plugin="$enable_all_plugins" diff --git a/src/backend/collectd.c b/src/backend/collectd.c index f745fc9..e0e924e 100644 --- a/src/backend/collectd.c +++ b/src/backend/collectd.c @@ -294,7 +294,7 @@ static int sdb_collectd_config_instance(oconfig_item_t *ci) { char *name = NULL; - char *socket = NULL; + char *socket_path = NULL; char cb_name[1024]; @@ -313,14 +313,14 @@ sdb_collectd_config_instance(oconfig_item_t *ci) oconfig_item_t *child = ci->children + i; if (! strcasecmp(child->key, "Socket")) - oconfig_get_string(child, &socket); + oconfig_get_string(child, &socket_path); else fprintf(stderr, "collectd backend: Ignoring unknown config " "option '%s' inside .\n", child->key, name); } - if (! socket) { + if (! socket_path) { fprintf(stderr, "collectd backend: Instance '%s' missing " "the 'Socket' option.\n", name); return -1; @@ -329,7 +329,7 @@ sdb_collectd_config_instance(oconfig_item_t *ci) snprintf(cb_name, sizeof(cb_name), "collectd-%s", name); cb_name[sizeof(cb_name) - 1] = '\0'; - client = sdb_unixsock_client_create(socket); + client = sdb_unixsock_client_create(socket_path); if (! client) { char errbuf[1024]; fprintf(stderr, "collectd backend: Failed to create unixsock client: " diff --git a/src/backend/mk-livestatus.c b/src/backend/mk-livestatus.c index 57fda52..a5126fb 100644 --- a/src/backend/mk-livestatus.c +++ b/src/backend/mk-livestatus.c @@ -238,7 +238,7 @@ static int sdb_livestatus_config_instance(oconfig_item_t *ci) { char *name = NULL; - char *socket = NULL; + char *socket_path = NULL; char cb_name[1024]; @@ -257,14 +257,14 @@ sdb_livestatus_config_instance(oconfig_item_t *ci) oconfig_item_t *child = ci->children + i; if (! strcasecmp(child->key, "Socket")) - oconfig_get_string(child, &socket); + oconfig_get_string(child, &socket_path); else fprintf(stderr, "MK Livestatus backend: Ignoring unknown config " "option '%s' inside .\n", child->key, name); } - if (! socket) { + if (! socket_path) { fprintf(stderr, "MK Livestatus backend: Instance '%s' missing " "the 'Socket' option.\n", name); return -1; @@ -273,7 +273,7 @@ sdb_livestatus_config_instance(oconfig_item_t *ci) snprintf(cb_name, sizeof(cb_name), "mk-livestatus-%s", name); cb_name[sizeof(cb_name) - 1] = '\0'; - client = sdb_unixsock_client_create(socket); + client = sdb_unixsock_client_create(socket_path); if (! client) { char errbuf[1024]; fprintf(stderr, "MK Livestatus backend: Failed to create unixsock " diff --git a/src/core/store.c b/src/core/store.c index e5cd886..cbd5f0c 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -197,33 +197,33 @@ sdb_host_create(const char *name) sdb_host_t * sdb_host_clone(const sdb_host_t *host) { - sdb_host_t *clone; + sdb_host_t *new; - clone = sdb_host_create(host->host_name); - if (! clone) + new = sdb_host_create(host->host_name); + if (! new) return NULL; /* make sure these are initialized; else sdb_object_deref() might access * arbitrary memory in case of an error */ - clone->services = clone->attributes = NULL; + new->services = new->attributes = NULL; if (host->attributes) { - clone->attributes = sdb_llist_clone(host->attributes); - if (! clone->attributes) { - sdb_object_deref(SDB_OBJ(clone)); + new->attributes = sdb_llist_clone(host->attributes); + if (! new->attributes) { + sdb_object_deref(SDB_OBJ(new)); return NULL; } } - clone->host_last_update = host->host_last_update; + new->host_last_update = host->host_last_update; if (host->services) { - clone->services = sdb_llist_clone(host->services); - if (! clone->services) { - sdb_object_deref(SDB_OBJ(clone)); + new->services = sdb_llist_clone(host->services); + if (! new->services) { + sdb_object_deref(SDB_OBJ(new)); return NULL; } } - return clone; + return new; } /* sdb_host_clone */ int @@ -350,15 +350,15 @@ sdb_attribute_create(const char *hostname, sdb_attribute_t * sdb_attribute_clone(const sdb_attribute_t *attr) { - sdb_attribute_t *clone; + sdb_attribute_t *new; - clone = sdb_attribute_create(attr->hostname, + new = sdb_attribute_create(attr->hostname, attr->attr_name, attr->attr_value); - if (! clone) + if (! new) return NULL; - clone->attr_last_update = attr->attr_last_update; - return clone; + new->attr_last_update = attr->attr_last_update; + return new; } /* sdb_attribute_clone */ int @@ -450,14 +450,14 @@ sdb_service_create(const char *hostname, const char *name) sdb_service_t * sdb_service_clone(const sdb_service_t *svc) { - sdb_service_t *clone; + sdb_service_t *new; - clone = sdb_service_create(svc->hostname, svc->svc_name); - if (! clone) + new = sdb_service_create(svc->hostname, svc->svc_name); + if (! new) return NULL; - clone->svc_last_update = svc->svc_last_update; - return clone; + new->svc_last_update = svc->svc_last_update; + return new; } /* sdb_service_clone */ int diff --git a/src/daemon/sysdbd.c b/src/daemon/sysdbd.c index 8b7ebd4..ef53a24 100644 --- a/src/daemon/sysdbd.c +++ b/src/daemon/sysdbd.c @@ -157,7 +157,7 @@ int main(int argc, char **argv) { char *config_filename = NULL; - _Bool daemon = 0; + _Bool do_daemonize = 0; struct sigaction sa_intterm; @@ -172,7 +172,7 @@ main(int argc, char **argv) config_filename = optarg; break; case 'd': - daemon = 1; + do_daemonize = 1; break; case 'h': @@ -214,7 +214,7 @@ main(int argc, char **argv) exit(1); } - if (daemon) + if (do_daemonize) if (daemonize()) exit(1); diff --git a/src/utils/llist.c b/src/utils/llist.c index e853001..7d573cf 100644 --- a/src/utils/llist.c +++ b/src/utils/llist.c @@ -167,28 +167,28 @@ sdb_llist_create(void) sdb_llist_t * sdb_llist_clone(sdb_llist_t *list) { - sdb_llist_t *clone; + sdb_llist_t *new; sdb_llist_elem_t *elem; if (! list) return NULL; - clone = sdb_llist_create(); - if (! clone) + new = sdb_llist_create(); + if (! new) return NULL; if (! list->length) { assert((! list->head) && (! list->tail)); - return clone; + return new; } for (elem = list->head; elem; elem = elem->next) { - if (sdb_llist_append(clone, elem->obj)) { - sdb_llist_destroy(clone); + if (sdb_llist_append(new, elem->obj)) { + sdb_llist_destroy(new); return NULL; } } - return clone; + return new; } /* sdb_llist_clone */ void