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/hast_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/hast_proto.c')
-rw-r--r-- | sbin/hastd/hast_proto.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sbin/hastd/hast_proto.c b/sbin/hastd/hast_proto.c index 439b0f3..039e767 100644 --- a/sbin/hastd/hast_proto.c +++ b/sbin/hastd/hast_proto.c @@ -114,13 +114,13 @@ hast_proto_send(const struct hast_resource *res, struct proto_conn *conn, hdr.version = HAST_PROTO_VERSION; hdr.size = htole32((uint32_t)ebuf_size(eb)); - if (ebuf_add_head(eb, &hdr, sizeof(hdr)) < 0) + if (ebuf_add_head(eb, &hdr, sizeof(hdr)) == -1) goto end; hptr = ebuf_data(eb, &hsize); - if (proto_send(conn, hptr, hsize) < 0) + if (proto_send(conn, hptr, hsize) == -1) goto end; - if (data != NULL && proto_send(conn, dptr, size) < 0) + if (data != NULL && proto_send(conn, dptr, size) == -1) goto end; ret = 0; @@ -141,7 +141,7 @@ hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp) eb = NULL; nv = NULL; - if (proto_recv(conn, &hdr, sizeof(hdr)) < 0) + if (proto_recv(conn, &hdr, sizeof(hdr)) == -1) goto fail; if (hdr.version != HAST_PROTO_VERSION) { @@ -154,11 +154,11 @@ hast_proto_recv_hdr(const struct proto_conn *conn, struct nv **nvp) eb = ebuf_alloc(hdr.size); if (eb == NULL) goto fail; - if (ebuf_add_tail(eb, NULL, hdr.size) < 0) + if (ebuf_add_tail(eb, NULL, hdr.size) == -1) goto fail; hptr = ebuf_data(eb, NULL); PJDLOG_ASSERT(hptr != NULL); - if (proto_recv(conn, hptr, hdr.size) < 0) + if (proto_recv(conn, hptr, hdr.size) == -1) goto fail; nv = nv_ntoh(eb); if (nv == NULL) @@ -196,7 +196,7 @@ hast_proto_recv_data(const struct hast_resource *res, struct proto_conn *conn, } else if (dsize == 0) { (void)nv_set_error(nv, 0); } else { - if (proto_recv(conn, data, dsize) < 0) + if (proto_recv(conn, data, dsize) == -1) goto end; for (ii = sizeof(pipeline) / sizeof(pipeline[0]); ii > 0; ii--) { |