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/proto.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/proto.c')
-rw-r--r-- | sbin/hastd/proto.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/hastd/proto.c b/sbin/hastd/proto.c index 452f82f..73487c0 100644 --- a/sbin/hastd/proto.c +++ b/sbin/hastd/proto.c @@ -419,14 +419,14 @@ proto_timeout(const struct proto_conn *conn, int timeout) PJDLOG_ASSERT(conn->pc_proto != NULL); fd = proto_descriptor(conn); - if (fd < 0) + if (fd == -1) return (-1); tv.tv_sec = timeout; tv.tv_usec = 0; - if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) == -1) return (-1); - if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) return (-1); return (0); |