diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-01-10 22:39:07 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2012-01-10 22:39:07 +0000 |
commit | 2b1b224d2486d7df9f51f12377e5f1e0ac9e3d78 (patch) | |
tree | 2219c6a6a85261711a382939a35cabc647cb7775 /sbin/hastd/hooks.c | |
parent | 45bd093cb0b87c730cae5adf4e2878a4f3b678cf (diff) | |
download | src-2b1b224d2486d7df9f51f12377e5f1e0ac9e3d78.tar.gz src-2b1b224d2486d7df9f51f12377e5f1e0ac9e3d78.zip |
For functions that return -1 on failure check exactly for -1 and not for
any negative number.
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=229945
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 60d48d1384fd..b1886caaeebf 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"); } |