diff --git a/src/hddtemp.c b/src/hddtemp.c
index bfb2621bc1861ff9a5c1556814c18a476e40c2b7..80b3419bee76d3e96efacb242bdba4f946efc5be 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
/**
* collectd - src/hddtemp.c
/**
* collectd - src/hddtemp.c
- * Copyright (C) 2005-2006 Vincent Stehlé
+ * Copyright (C) 2005,2006 Vincent Stehlé
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
static char *ds_def[] =
{
static char *ds_def[] =
{
- "DS:value:GAUGE:25:U:U",
+ "DS:value:GAUGE:"COLLECTD_HEARTBEAT":U:U",
NULL
};
static int ds_num = 1;
NULL
};
static int ds_num = 1;
fd = -1;
continue;
}
fd = -1;
continue;
}
+
+ /* A socket could be opened and connecting succeeded. We're
+ * done. */
+ break;
}
freeaddrinfo (ai_list);
}
freeaddrinfo (ai_list);
syslog (LOG_ERR, "hddtemp: Error reading from socket: %s",
strerror (errno));
syslog (LOG_ERR, "hddtemp: Error reading from socket: %s",
strerror (errno));
+ close (fd);
return (-1);
}
buffer_fill += status;
return (-1);
}
buffer_fill += status;
* operating-systems, it's not done at all. */
static void hddtemp_init (void)
{
* operating-systems, it's not done at all. */
static void hddtemp_init (void)
{
-#if defined(KERNEL_LINUX)
+#if KERNEL_LINUX
FILE *fh;
char buf[BUFFER_SIZE];
int buflen;
FILE *fh;
char buf[BUFFER_SIZE];
int buflen;
if ((entry = (hddname_t *) malloc (sizeof (hddname_t))) == NULL)
{
if ((entry = (hddname_t *) malloc (sizeof (hddname_t))) == NULL)
{
- syslog (LOG_ERR, "hddtemp: malloc (%u) == NULL", sizeof (hddname_t));
+ syslog (LOG_ERR, "hddtemp: malloc (%u) == NULL",
+ (unsigned int) sizeof (hddname_t));
free (name);
continue;
}
free (name);
continue;
}
first_hddname = entry;
}
}
first_hddname = entry;
}
}
+ fclose (fh);
}
else
DBG ("Could not open /proc/partitions: %s",
}
else
DBG ("Could not open /proc/partitions: %s",