summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/subr.c
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/hastd/subr.c
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/hastd/subr.c')
-rw-r--r--sbin/hastd/subr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/hastd/subr.c b/sbin/hastd/subr.c
index b8ee389..ae6f984 100644
--- a/sbin/hastd/subr.c
+++ b/sbin/hastd/subr.c
@@ -86,13 +86,13 @@ provinfo(struct hast_resource *res, bool dowrite)
if (res->hr_localfd == -1) {
res->hr_localfd = open(res->hr_localpath,
dowrite ? O_RDWR : O_RDONLY);
- if (res->hr_localfd < 0) {
+ if (res->hr_localfd == -1) {
pjdlog_errno(LOG_ERR, "Unable to open %s",
res->hr_localpath);
return (-1);
}
}
- if (fstat(res->hr_localfd, &sb) < 0) {
+ if (fstat(res->hr_localfd, &sb) == -1) {
pjdlog_errno(LOG_ERR, "Unable to stat %s", res->hr_localpath);
return (-1);
}
@@ -101,14 +101,14 @@ provinfo(struct hast_resource *res, bool dowrite)
* If this is character device, it is most likely GEOM provider.
*/
if (ioctl(res->hr_localfd, DIOCGMEDIASIZE,
- &res->hr_local_mediasize) < 0) {
+ &res->hr_local_mediasize) == -1) {
pjdlog_errno(LOG_ERR,
"Unable obtain provider %s mediasize",
res->hr_localpath);
return (-1);
}
if (ioctl(res->hr_localfd, DIOCGSECTORSIZE,
- &res->hr_local_sectorsize) < 0) {
+ &res->hr_local_sectorsize) == -1) {
pjdlog_errno(LOG_ERR,
"Unable obtain provider %s sectorsize",
res->hr_localpath);
OpenPOWER on IntegriCloud