projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Treewide: cleanup whitespace
[collectd.git]
/
src
/
exec.c
diff --git
a/src/exec.c
b/src/exec.c
index
0445b14
..
85f6cb8
100644
(file)
--- a/
src/exec.c
+++ b/
src/exec.c
@@
-18,11
+18,12
@@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* 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>
* Sebastian Harl <sh at tokkee.org>
* Peter Holik <peter at holik.at>
**/
* Sebastian Harl <sh at tokkee.org>
* Peter Holik <peter at holik.at>
**/
+#define _DEFAULT_SOURCE
#define _BSD_SOURCE /* For setgroups */
#include "collectd.h"
#define _BSD_SOURCE /* For setgroups */
#include "collectd.h"
@@
-125,13
+126,12
@@
static int exec_config_exec (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- pl =
(program_list_t *) malloc (sizeof (program_list_t
));
+ pl =
calloc (1, sizeof (*pl
));
if (pl == NULL)
{
if (pl == NULL)
{
- ERROR ("exec plugin:
m
alloc failed.");
+ ERROR ("exec plugin:
c
alloc failed.");
return (-1);
}
return (-1);
}
- memset (pl, '\0', sizeof (program_list_t));
if (strcasecmp ("NotificationExec", ci->key) == 0)
pl->flags |= PL_NOTIF_ACTION;
if (strcasecmp ("NotificationExec", ci->key) == 0)
pl->flags |= PL_NOTIF_ACTION;
@@
-162,16
+162,15
@@
static int exec_config_exec (oconfig_item_t *ci) /* {{{ */
return (-1);
}
return (-1);
}
- pl->argv =
(char **) malloc (ci->values_num * sizeof (char *
));
+ pl->argv =
calloc (ci->values_num, sizeof (*pl->argv
));
if (pl->argv == NULL)
{
if (pl->argv == NULL)
{
- ERROR ("exec plugin:
m
alloc failed.");
+ ERROR ("exec plugin:
c
alloc failed.");
sfree (pl->exec);
sfree (pl->user);
sfree (pl);
return (-1);
}
sfree (pl->exec);
sfree (pl->user);
sfree (pl);
return (-1);
}
- memset (pl->argv, '\0', ci->values_num * sizeof (char *));
{
char *tmp = strrchr (ci->values[1].value.string, '/');
{
char *tmp = strrchr (ci->values[1].value.string, '/');
@@
-183,7
+182,7
@@
static int exec_config_exec (oconfig_item_t *ci) /* {{{ */
pl->argv[0] = strdup (buffer);
if (pl->argv[0] == NULL)
{
pl->argv[0] = strdup (buffer);
if (pl->argv[0] == NULL)
{
- ERROR ("exec plugin:
malloc
failed.");
+ ERROR ("exec plugin:
strdup
failed.");
sfree (pl->argv);
sfree (pl->exec);
sfree (pl->user);
sfree (pl->argv);
sfree (pl->exec);
sfree (pl->user);
@@
-868,8
+867,7
@@
static int exec_notification (const notification_t *n, /* {{{ */
if (pl->pid != 0)
continue;
if (pl->pid != 0)
continue;
- pln = (program_list_and_notification_t *) malloc (sizeof
- (program_list_and_notification_t));
+ pln = malloc (sizeof (*pln));
if (pln == NULL)
{
ERROR ("exec plugin: malloc failed.");
if (pln == NULL)
{
ERROR ("exec plugin: malloc failed.");