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
1 | 2 | |||
---|---|---|---|---|
configure.in | patch | | diff1 | | diff2 | | blob | history |
src/mysql.c | patch | | diff1 | | diff2 | | blob | history |
src/network.c | patch | | diff1 | | diff2 | | blob | history |
src/thermal.c | patch | | diff1 | | diff2 | | blob | history |
diff --cc configure.in
index 5e812a106bb23f119584b96072a3940789a3b457,0b126301ba79064fd76409f5329bab89a3eafe9f..b75386d0fe5d5896d677612f83685eb070ae8f54
--- 1/configure.in
--- 2/configure.in
+++ b/configure.in
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
- ]]])],
+]]]
+ )],
[c_cv_have_strtok_r_default="yes"],
[c_cv_have_strtok_r_default="no"]
)
saveptr = NULL;
while ((token = strtok_r (dummy, ",", &saveptr)) != NULL)
{
- dummy = NULL;
+ dummy = NULL;
printf ("token = %s;\n", token);
}
- ]]])],
+]]]
+ )],
[c_cv_have_strtok_r_reentrant="yes"],
[AC_MSG_FAILURE([strtok_r isn't available. Please file a bugreport!])]
)
diff --cc src/mysql.c
index 6f2d69abbfd6501b830830f25c27a15b0ed4d5de,8b3cd210a9d48e49d854ec4b1d01ed3287ff9591..d2d0b4bfc57a9ad695b592835cadd4707935fac0
--- 1/src/mysql.c
--- 2/src/mysql.c
+++ b/src/mysql.c
char *socket;
int port;
- int master_stats;
- int slave_stats;
+ _Bool master_stats;
+ _Bool slave_stats;
- int slave_notif;
- int slave_io_running;
- int slave_sql_running;
+ _Bool slave_notif;
+ _Bool slave_io_running;
+ _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 != NULL)
- ? db->instance
- : "<legacy>",
- mysql_error (db->con));
++ 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,
diff --cc src/network.c
index 3f0c6fa1a08858def27ffd167362475faf0fcbc8,d0ff6bca430c890e30178eef24498e5775bca32f..4a5424605b3ead237e6311167d7fd3dc067319c1
--- 1/src/network.c
--- 2/src/network.c
+++ b/src/network.c
* nothing more to do (for now, that is). */
if (have_init)
return (0);
- have_init = true;
+ 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 --cc src/thermal.c
index 0ad0d90a04377126132e35cad77e4d592a844a1d,5d3da89254655b9b1434af427ddbf30c6f5b7716..603f85bbf6a96595ee04891127f37006d90730aa
--- 1/src/thermal.c
--- 2/src/thermal.c
+++ b/src/thermal.c
static void thermal_submit (const char *plugin_instance, enum dev_type dt,
gauge_t value)
{
- value_list_t vl = (dt == TEMP) ? vl_temp_template : vl_state_template;
- value_t vt;
+ value_list_t vl = VALUE_LIST_INIT;
+ value_t v;
- vt.gauge = value;
+ v.gauge = value;
+ vl.values = &v;
- vl.values = &vt;
+ vl.values_len = 1;
+
+ sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "thermal", sizeof(vl.plugin));
- sstrncpy (vl.plugin_instance, plugin_instance,
- sizeof(vl.plugin_instance));
- sstrncpy (vl.type, (dt == TEMP) ? "temperature" : "gauge",
+ if (plugin_instance != NULL)
+ sstrncpy (vl.plugin_instance, plugin_instance,
+ sizeof (vl.plugin_instance));
+ sstrncpy (vl.type,
+ (dt == TEMP) ? "temperature" : "gauge",
sizeof (vl.type));
plugin_dispatch_values (&vl);