projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1455 from rubenk/configure-ac-remove-dead-code
[collectd.git]
/
src
/
exec.c
diff --git
a/src/exec.c
b/src/exec.c
old mode 100755
(executable)
new mode 100644
(file)
index
a905633
..
f080ad6
--- 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"
@@
-354,18
+355,7
@@
static void reset_signal_mask (void) /* {{{ */
sigprocmask (SIG_SETMASK, &ss, /* old mask = */ NULL);
} /* }}} void reset_signal_mask */
sigprocmask (SIG_SETMASK, &ss, /* old mask = */ NULL);
} /* }}} void reset_signal_mask */
-static void close_pipe(int fd_pipe[2])
-{
- if(fd_pipe[0] != -1) {
- close(fd_pipe[0]);
- }
-
- if(fd_pipe[1] != -1) {
- close(fd_pipe[1]);
- }
-}
-
-static int create_pipe(int fd_pipe[2])
+static int create_pipe (int fd_pipe[2]) /* {{{ */
{
char errbuf[1024];
int status;
{
char errbuf[1024];
int status;
@@
-379,7
+369,16
@@
static int create_pipe(int fd_pipe[2])
}
return 0;
}
return 0;
-}
+} /* }}} int create_pipe */
+
+static void close_pipe (int fd_pipe[2]) /* {{{ */
+{
+ if (fd_pipe[0] != -1)
+ close (fd_pipe[0]);
+
+ if (fd_pipe[1] != -1)
+ close (fd_pipe[1]);
+} /* }}} void close_pipe */
/*
* Creates three pipes (one for reading, one for writing and one for errors),
/*
* Creates three pipes (one for reading, one for writing and one for errors),
@@
-407,9
+406,10
@@
static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
if (pl->pid != 0)
return (-1);
if (pl->pid != 0)
return (-1);
- if(create_pipe(fd_pipe_in) == -1 || create_pipe(fd_pipe_out) == -1 || create_pipe(fd_pipe_err) == -1) {
+ if ((create_pipe(fd_pipe_in) == -1)
+ || (create_pipe(fd_pipe_out) == -1)
+ || (create_pipe(fd_pipe_err) == -1))
goto failed;
goto failed;
- }
sp_ptr = NULL;
status = getpwnam_r (pl->user, &sp, nambuf, sizeof (nambuf), &sp_ptr);
sp_ptr = NULL;
status = getpwnam_r (pl->user, &sp, nambuf, sizeof (nambuf), &sp_ptr);