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/control.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/control.c')
-rw-r--r-- | sbin/hastd/control.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sbin/hastd/control.c b/sbin/hastd/control.c index 2e99366240a8..925fd32645cb 100644 --- a/sbin/hastd/control.c +++ b/sbin/hastd/control.c @@ -115,7 +115,7 @@ control_set_role_common(struct hastd_config *cfg, struct nv *nvout, * doing that work. */ if (res->hr_workerpid != 0) { - if (kill(res->hr_workerpid, SIGTERM) < 0) { + if (kill(res->hr_workerpid, SIGTERM) == -1) { pjdlog_errno(LOG_WARNING, "Unable to kill worker process %u", (unsigned int)res->hr_workerpid); @@ -167,7 +167,7 @@ control_status_worker(struct hast_resource *res, struct nv *nvout, "Unable to prepare control header"); goto end; } - if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) < 0) { + if (hast_proto_send(res, res->hr_ctrl, cnvout, NULL, 0) == -1) { error = errno; pjdlog_errno(LOG_ERR, "Unable to send control header"); goto end; @@ -176,7 +176,7 @@ control_status_worker(struct hast_resource *res, struct nv *nvout, /* * Receive response. */ - if (hast_proto_recv_hdr(res->hr_ctrl, &cnvin) < 0) { + if (hast_proto_recv_hdr(res->hr_ctrl, &cnvin) == -1) { error = errno; pjdlog_errno(LOG_ERR, "Unable to receive control header"); goto end; @@ -293,7 +293,7 @@ control_handle(struct hastd_config *cfg) uint8_t cmd, role; int error; - if (proto_accept(cfg->hc_controlconn, &conn) < 0) { + if (proto_accept(cfg->hc_controlconn, &conn) == -1) { pjdlog_errno(LOG_ERR, "Unable to accept control connection"); return; } @@ -302,7 +302,7 @@ control_handle(struct hastd_config *cfg) nvin = nvout = NULL; role = HAST_ROLE_UNDEF; - if (hast_proto_recv_hdr(conn, &nvin) < 0) { + if (hast_proto_recv_hdr(conn, &nvin) == -1) { pjdlog_errno(LOG_ERR, "Unable to receive control header"); nvin = NULL; goto close; @@ -395,7 +395,7 @@ fail: if (error != 0) nv_add_int16(nvout, error, "error"); - if (hast_proto_send(NULL, conn, nvout, NULL, 0) < 0) + if (hast_proto_send(NULL, conn, nvout, NULL, 0) == -1) pjdlog_errno(LOG_ERR, "Unable to send control response"); close: if (nvin != NULL) @@ -417,7 +417,7 @@ ctrl_thread(void *arg) uint8_t cmd; for (;;) { - if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) < 0) { + if (hast_proto_recv_hdr(res->hr_ctrl, &nvin) == -1) { if (sigexit_received) pthread_exit(NULL); pjdlog_errno(LOG_ERR, @@ -481,7 +481,7 @@ ctrl_thread(void *arg) nv_free(nvout); continue; } - if (hast_proto_send(NULL, res->hr_ctrl, nvout, NULL, 0) < 0) { + if (hast_proto_send(NULL, res->hr_ctrl, nvout, NULL, 0) == -1) { pjdlog_errno(LOG_ERR, "Unable to send reply to control message"); } |