From c5fe5a76f24f997008c868c17e6fe6ed1b2aaf7b Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 10 Jan 2012 22:39:07 +0000 Subject: For functions that return -1 on failure check exactly for -1 and not for any negative number. MFC after: 3 days --- sbin/hastd/proto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sbin/hastd/proto.c') 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); -- cgit v1.1