author | Florian Forster <octo@collectd.org> | |
Sun, 7 Apr 2013 03:44:38 +0000 (05:44 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 7 Apr 2013 03:44:38 +0000 (05:44 +0200) |
Conflicts:
configure.in
src/mysql.c
src/network.c
src/thermal.c
configure.in
src/mysql.c
src/network.c
src/thermal.c
configure.in | patch | blob | history | |
src/filter_chain.c | patch | blob | history | |
src/mysql.c | patch | blob | history | |
src/network.c | patch | blob | history | |
src/thermal.c | patch | blob | history | |
src/utils_parse_option.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 5e812a106bb23f119584b96072a3940789a3b457..b75386d0fe5d5896d677612f83685eb070ae8f54 100644 (file)
--- a/configure.in
+++ b/configure.in
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
]]]
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
]]]
if test -d "$with_java_home"
then
AC_MSG_CHECKING([for jni.h])
- TMPDIR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for jni_md.h])
- TMPDIR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_CPPFLAGS="$JAVA_CPPFLAGS -I$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
AC_MSG_CHECKING([for libjvm.so])
- TMPDIR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- AC_MSG_RESULT([found in $TMPDIR])
- JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPDIR -Wl,-rpath -Wl,$TMPDIR"
+ AC_MSG_RESULT([found in $TMPVAR])
+ JAVA_LDFLAGS="$JAVA_LDFLAGS -L$TMPVAR -Wl,-rpath -Wl,$TMPVAR"
else
AC_MSG_RESULT([not found])
fi
if test "x$JAVAC" = "x"
then
AC_MSG_CHECKING([for javac])
- TMPDIR=`find "$with_java_home" -name javac -type f | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name javac -type f | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- JAVAC="$TMPDIR"
+ JAVAC="$TMPVAR"
AC_MSG_RESULT([$JAVAC])
else
AC_MSG_RESULT([not found])
if test "x$JAR" = "x"
then
AC_MSG_CHECKING([for jar])
- TMPDIR=`find "$with_java_home" -name jar -type f | head -n 1`
- if test "x$TMPDIR" != "x"
+ TMPVAR=`find "$with_java_home" -name jar -type f | head -n 1`
+ if test "x$TMPVAR" != "x"
then
- JAR="$TMPDIR"
+ JAR="$TMPVAR"
AC_MSG_RESULT([$JAR])
else
AC_MSG_RESULT([not found])
diff --git a/src/filter_chain.c b/src/filter_chain.c
index ed2df61c9c5b16f35a0e6953ab0f9ca5da03fc8b..7d8369b901def7d9633e78e6c73de5b14cc26f92 100644 (file)
--- a/src/filter_chain.c
+++ b/src/filter_chain.c
(*m->proc.destroy) (&m->user_data);
else if (m->user_data != NULL)
{
- ERROR ("Filter sybsystem: fc_free_matches: There is user data, but no "
+ ERROR ("Filter subsystem: fc_free_matches: There is user data, but no "
"destroy functions has been specified. "
"Memory will probably be lost!");
}
(*t->proc.destroy) (&t->user_data);
else if (t->user_data != NULL)
{
- ERROR ("Filter sybsystem: fc_free_targets: There is user data, but no "
+ ERROR ("Filter subsystem: fc_free_targets: There is user data, but no "
"destroy functions has been specified. "
"Memory will probably be lost!");
}
diff --git a/src/mysql.c b/src/mysql.c
index 6f2d69abbfd6501b830830f25c27a15b0ed4d5de..d2d0b4bfc57a9ad695b592835cadd4707935fac0 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
_Bool slave_sql_running;
MYSQL *con;
- int state;
+ _Bool is_connected;
};
typedef struct mysql_database_s mysql_database_t; /* }}} */
static MYSQL *getconnection (mysql_database_t *db)
{
- if (db->state != 0)
+ if (db->is_connected)
{
- int err;
- if ((err = mysql_ping (db->con)) != 0)
- {
- /* Assured by "mysql_config_database" */
- assert (db->instance != NULL);
- WARNING ("mysql_ping failed for instance \"%s\": %s",
- db->instance,
- mysql_error (db->con));
- db->state = 0;
- }
- else
- {
- db->state = 1;
+ int status;
+
+ status = mysql_ping (db->con);
+ if (status == 0)
return (db->con);
- }
+
+ WARNING ("mysql plugin: Lost connection to instance \"%s\": %s",
+ db->instance, mysql_error (db->con));
}
+ db->is_connected = 0;
- if ((db->con = mysql_init (db->con)) == NULL)
+ if (db->con == NULL)
{
- ERROR ("mysql_init failed: %s", mysql_error (db->con));
- db->state = 0;
- return (NULL);
+ db->con = mysql_init (NULL);
+ if (db->con == NULL)
+ {
+ ERROR ("mysql plugin: mysql_init failed: %s",
+ mysql_error (db->con));
+ return (NULL);
+ }
}
if (mysql_real_connect (db->con, db->host, db->user, db->pass,
(db->database != NULL) ? db->database : "<none>",
(db->host != NULL) ? db->host : "localhost",
mysql_error (db->con));
- db->state = 0;
return (NULL);
}
- else
- {
- INFO ("mysql plugin: Successfully connected to database %s "
- "at server %s (server version: %s, protocol version: %d)",
- (db->database != NULL) ? db->database : "<none>",
- mysql_get_host_info (db->con),
- mysql_get_server_info (db->con),
- mysql_get_proto_info (db->con));
- db->state = 1;
- return (db->con);
- }
+
+ INFO ("mysql plugin: Successfully connected to database %s "
+ "at server %s (server version: %s, protocol version: %d)",
+ (db->database != NULL) ? db->database : "<none>",
+ mysql_get_host_info (db->con),
+ mysql_get_server_info (db->con),
+ mysql_get_proto_info (db->con));
+
+ db->is_connected = 1;
+ return (db->con);
} /* static MYSQL *getconnection (mysql_database_t *db) */
static void set_host (mysql_database_t *db, char *buf, size_t buflen)
diff --git a/src/network.c b/src/network.c
index 3f0c6fa1a08858def27ffd167362475faf0fcbc8..4a5424605b3ead237e6311167d7fd3dc067319c1 100644 (file)
--- a/src/network.c
+++ b/src/network.c
/**
* collectd - src/network.c
- * Copyright (C) 2005-2010 Florian octo Forster
+ * Copyright (C) 2005-2013 Florian octo Forster
* Copyright (C) 2009 Aman Gupta
*
* This program is free software; you can redistribute it and/or modify it
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at verplant.org>
+ * Florian octo Forster <octo at collectd.org>
* Aman Gupta <aman at tmm1.net>
**/
} /* }}} int network_dispatch_notification */
#if HAVE_LIBGCRYPT
+static void network_init_gcrypt (void) /* {{{ */
+{
+ /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
+ * Because you can't know in a library whether another library has
+ * already initialized the library */
+ if (gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
+ return;
+
+ gcry_check_version (NULL); /* before calling any other functions */
+ gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
+ gcry_control (GCRYCTL_INIT_SECMEM, 32768);
+ gcry_control (GCRYCTL_INITIALIZATION_FINISHED);
+} /* }}} void network_init_gcrypt */
+
static gcry_cipher_hd_t network_get_aes256_cypher (sockent_t *se, /* {{{ */
const void *iv, size_t iv_size, const char *username)
{
{
if (se->data.client.security_level > SECURITY_LEVEL_NONE)
{
+ network_init_gcrypt ();
+
if ((se->data.client.username == NULL)
|| (se->data.client.password == NULL))
{
{
if (se->data.server.security_level > SECURITY_LEVEL_NONE)
{
+ network_init_gcrypt ();
+
if (se->data.server.auth_file == NULL)
{
ERROR ("network plugin: Server socket with "
have_init = 1;
#if HAVE_LIBGCRYPT
- /* http://lists.gnupg.org/pipermail/gcrypt-devel/2003-August/000458.html
- * Because you can't know in a library whether another library has
- * already initialized the library
- */
- if (!gcry_control (GCRYCTL_ANY_INITIALIZATION_P))
- {
- gcry_check_version(NULL); /* before calling any other functions */
- gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
- gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0);
- gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
- }
+ network_init_gcrypt ();
#endif
if (network_config_stats != 0)
diff --git a/src/thermal.c b/src/thermal.c
index 0ad0d90a04377126132e35cad77e4d592a844a1d..603f85bbf6a96595ee04891127f37006d90730aa 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
v.gauge = value;
vl.values = &v;
+ vl.values_len = 1;
+
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "thermal", sizeof(vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance,
index 2168cd1af3d624801146905b853adb0c92db3d7b..820f14f58ef1da32cdfbe73c016c7fefdba4a0b0 100644 (file)
--- a/src/utils_parse_option.c
+++ b/src/utils_parse_option.c
/* Look for the equal sign */
buffer = key;
- while (isalnum ((int) *buffer))
+ while (isalnum ((int) *buffer) || *buffer == '_')
buffer++;
if ((*buffer != '=') || (buffer == key))
return (1);