summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Hall <halex@cvs.openbsd.org>2012-11-12 14:07:21 +0000
committerAlexander Hall <halex@cvs.openbsd.org>2012-11-12 14:07:21 +0000
commit8a213abcf1d0cdc83d4a65bcfc676efddcffeaa4 (patch)
tree3d5e3e4cbc800e26dc9990881adf84558b62866f
parent61057db30c304cd21d1dc3d43321f5a91927c9d1 (diff)
make scan_scaled set errno to EINVAL rather than ERANGE if it encounters
an invalid multiplier, like the man page says it should "looks sensible" deraadt@, ok ian@
-rw-r--r--lib/libutil/fmt_scaled.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libutil/fmt_scaled.c b/lib/libutil/fmt_scaled.c
index 58f8d2452a0..83f9fa91fc0 100644
--- a/lib/libutil/fmt_scaled.c
+++ b/lib/libutil/fmt_scaled.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt_scaled.c,v 1.10 2009/06/20 15:00:04 martynas Exp $ */
+/* $OpenBSD: fmt_scaled.c,v 1.11 2012/11/12 14:07:20 halex Exp $ */
/*
* Copyright (c) 2001, 2002, 2003 Ian F. Darwin. All rights reserved.
@@ -177,7 +177,9 @@ scan_scaled(char *scaled, long long *result)
return 0;
}
}
- errno = ERANGE;
+
+ /* Invalid unit or character */
+ errno = EINVAL;
return -1;
}