aboutsummaryrefslogtreecommitdiff
path: root/sbin/camcontrol
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2019-07-15 23:43:38 +0000
committerWarner Losh <imp@FreeBSD.org>2019-07-15 23:43:38 +0000
commit237024606ad6c548c1b765118e176b2c416391a1 (patch)
tree497d1f960e6bf4a4c80ae7045648cac40e27d1a9 /sbin/camcontrol
parentf53a2a1f6111187ff6fea8fb6e050bf512fd06e3 (diff)
downloadsrc-237024606ad6c548c1b765118e176b2c416391a1.tar.gz
src-237024606ad6c548c1b765118e176b2c416391a1.zip
Use a different approach to range check.
gcc hates dt < CC_DT_NONE since it can never be true when dt is an unsigned type. Since that's a compiler choice and may be affected by weird stuff, instead use (unsigned)dt > CC_DT_UNKNOWN to test for bounds error since that will work regardless of the signedness of dt.
Notes
Notes: svn path=/head/; revision=350020
Diffstat (limited to 'sbin/camcontrol')
-rw-r--r--sbin/camcontrol/camcontrol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 17350c18fcb5..d24ec7d4f23c 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -676,7 +676,7 @@ getdevtype(struct cam_device *cam_dev)
* Get the device type and report it, request no I/O be done to do this.
*/
error = get_device_type(cam_dev, -1, 0, 0, &dt);
- if (error != 0 || dt < CC_DT_NONE || dt > CC_DT_UNKNOWN) {
+ if (error != 0 || (unsigned)dt > CC_DT_UNKNOWN) {
fprintf(stdout, "illegal\n");
return (1);
}