summaryrefslogtreecommitdiffstats
path: root/sbin/hastctl
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-01-10 22:39:07 +0000
committerpjd <pjd@FreeBSD.org>2012-01-10 22:39:07 +0000
commitc5fe5a76f24f997008c868c17e6fe6ed1b2aaf7b (patch)
tree2219c6a6a85261711a382939a35cabc647cb7775 /sbin/hastctl
parent29f76d890ec6d66428132ae19aece81336519a79 (diff)
downloadFreeBSD-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/hastctl')
-rw-r--r--sbin/hastctl/hastctl.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sbin/hastctl/hastctl.c b/sbin/hastctl/hastctl.c
index 838e11d..0bd47f2 100644
--- a/sbin/hastctl/hastctl.c
+++ b/sbin/hastctl/hastctl.c
@@ -104,7 +104,7 @@ create_one(struct hast_resource *res, intmax_t mediasize, intmax_t extentsize,
ec = 0;
pjdlog_prefix_set("[%s] ", res->hr_name);
- if (provinfo(res, true) < 0) {
+ if (provinfo(res, true) == -1) {
ec = EX_NOINPUT;
goto end;
}
@@ -146,7 +146,7 @@ create_one(struct hast_resource *res, intmax_t mediasize, intmax_t extentsize,
res->hr_localoff = METADATA_SIZE + mapsize;
- if (metadata_write(res) < 0) {
+ if (metadata_write(res) == -1) {
ec = EX_IOERR;
goto end;
}
@@ -401,15 +401,15 @@ main(int argc, char *argv[])
debug++;
break;
case 'e':
- if (expand_number(optarg, &extentsize) < 0)
+ if (expand_number(optarg, &extentsize) == -1)
errx(EX_USAGE, "Invalid extentsize");
break;
case 'k':
- if (expand_number(optarg, &keepdirty) < 0)
+ if (expand_number(optarg, &keepdirty) == -1)
errx(EX_USAGE, "Invalid keepdirty");
break;
case 'm':
- if (expand_number(optarg, &mediasize) < 0)
+ if (expand_number(optarg, &mediasize) == -1)
errx(EX_USAGE, "Invalid mediasize");
break;
case 'h':
@@ -479,13 +479,13 @@ main(int argc, char *argv[])
}
/* Setup control connection... */
- if (proto_client(NULL, cfg->hc_controladdr, &controlconn) < 0) {
+ if (proto_client(NULL, cfg->hc_controladdr, &controlconn) == -1) {
pjdlog_exit(EX_OSERR,
"Unable to setup control connection to %s",
cfg->hc_controladdr);
}
/* ...and connect to hastd. */
- if (proto_connect(controlconn, HAST_TIMEOUT) < 0) {
+ if (proto_connect(controlconn, HAST_TIMEOUT) == -1) {
pjdlog_exit(EX_OSERR, "Unable to connect to hastd via %s",
cfg->hc_controladdr);
}
@@ -494,14 +494,14 @@ main(int argc, char *argv[])
exit(EX_CONFIG);
/* Send the command to the server... */
- if (hast_proto_send(NULL, controlconn, nv, NULL, 0) < 0) {
+ if (hast_proto_send(NULL, controlconn, nv, NULL, 0) == -1) {
pjdlog_exit(EX_UNAVAILABLE,
"Unable to send command to hastd via %s",
cfg->hc_controladdr);
}
nv_free(nv);
/* ...and receive reply. */
- if (hast_proto_recv_hdr(controlconn, &nv) < 0) {
+ if (hast_proto_recv_hdr(controlconn, &nv) == -1) {
pjdlog_exit(EX_UNAVAILABLE,
"cannot receive reply from hastd via %s",
cfg->hc_controladdr);
OpenPOWER on IntegriCloud