summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b333eb9)
raw | patch | inline | side by side (parent: b333eb9)
author | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 10:14:28 +0000 (11:14 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 8 Dec 2015 10:14:28 +0000 (11:14 +0100) |
This is to make Coverity happy.
CID: 38011, 38012
CID: 38011, 38012
src/collectdmon.c | patch | blob | history | |
src/daemon/collectd.c | patch | blob | history |
diff --git a/src/collectdmon.c b/src/collectdmon.c
index 33f02b45694d889d07613a05110230c1b32d7442..f2798eef5f0384b210c8c4a8007f671a5645fecc 100644 (file)
--- a/src/collectdmon.c
+++ b/src/collectdmon.c
static int daemonize (void)
{
struct rlimit rl;
+ int status;
pid_t pid = 0;
int i = 0;
close (i);
errno = 0;
- if (open ("/dev/null", O_RDWR) != 0) {
+ status = open ("/dev/null", O_RDWR);
+ if (status != 0) {
syslog (LOG_ERR, "Error: couldn't connect STDIN to /dev/null: %s",
strerror (errno));
return -1;
}
errno = 0;
- if (dup (0) != 1) {
+ status = dup (0);
+ if (status != 1) {
syslog (LOG_ERR, "Error: couldn't connect STDOUT to /dev/null: %s",
strerror (errno));
return -1;
}
errno = 0;
- if (dup (0) != 2) {
+ status = dup (0);
+ if (status != 2) {
syslog (LOG_ERR, "Error: couldn't connect STDERR to /dev/null: %s",
strerror (errno));
return -1;
diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c
index 06125dce5fa97097e5be76178e89cf4bea3a193d..7b324e1e3a6513b47bf453e634c91bedfa831bea 100644 (file)
--- a/src/daemon/collectd.c
+++ b/src/daemon/collectd.c
#endif
)
{
+ int status;
+
if ((pid = fork ()) == -1)
{
/* error */
close (1);
close (0);
- if (open ("/dev/null", O_RDWR) != 0)
+ status = open ("/dev/null", O_RDWR);
+ if (status != 0)
{
- ERROR ("Error: Could not connect `STDIN' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDIN' to `/dev/null' (status %d)", status);
return (1);
}
- if (dup (0) != 1)
+
+ status = dup (0);
+ if (status != 1)
{
- ERROR ("Error: Could not connect `STDOUT' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDOUT' to `/dev/null' (status %d)", status);
return (1);
}
- if (dup (0) != 2)
+
+ status = dup (0);
+ if (status != 2)
{
- ERROR ("Error: Could not connect `STDERR' to `/dev/null'");
+ ERROR ("Error: Could not connect `STDERR' to `/dev/null', (status %d)", status);
return (1);
}
} /* if (daemonize) */