diff options
author | pjd <pjd@FreeBSD.org> | 2012-01-10 22:39:07 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-01-10 22:39:07 +0000 |
commit | c5fe5a76f24f997008c868c17e6fe6ed1b2aaf7b (patch) | |
tree | 2219c6a6a85261711a382939a35cabc647cb7775 /sbin/hastd/hooks.c | |
parent | 29f76d890ec6d66428132ae19aece81336519a79 (diff) | |
download | FreeBSD-src-c5fe5a76f24f997008c868c17e6fe6ed1b2aaf7b.zip FreeBSD-src-c5fe5a76f24f997008c868c17e6fe6ed1b2aaf7b.tar.gz |
For functions that return -1 on failure check exactly for -1 and not for
any negative number.
MFC after: 3 days
Diffstat (limited to 'sbin/hastd/hooks.c')
-rw-r--r-- | sbin/hastd/hooks.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/hastd/hooks.c b/sbin/hastd/hooks.c index 60d48d1..b1886ca 100644 --- a/sbin/hastd/hooks.c +++ b/sbin/hastd/hooks.c @@ -105,26 +105,26 @@ descriptors(void) * Redirect stdin, stdout and stderr to /dev/null. */ fd = open(_PATH_DEVNULL, O_RDONLY); - if (fd < 0) { + if (fd == -1) { pjdlog_errno(LOG_WARNING, "Unable to open %s for reading", _PATH_DEVNULL); } else if (fd != STDIN_FILENO) { - if (dup2(fd, STDIN_FILENO) < 0) { + if (dup2(fd, STDIN_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stdin"); } close(fd); } fd = open(_PATH_DEVNULL, O_WRONLY); - if (fd < 0) { + if (fd == -1) { pjdlog_errno(LOG_WARNING, "Unable to open %s for writing", _PATH_DEVNULL); } else { - if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) < 0) { + if (fd != STDOUT_FILENO && dup2(fd, STDOUT_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stdout"); } - if (fd != STDERR_FILENO && dup2(fd, STDERR_FILENO) < 0) { + if (fd != STDERR_FILENO && dup2(fd, STDERR_FILENO) == -1) { pjdlog_errno(LOG_WARNING, "Unable to duplicate descriptor for stderr"); } |