diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2017-06-14 03:00:41 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2017-06-14 03:00:41 +0000 |
commit | fe6a87c8fb7d5ce5eca5acc11c5bb47f8478075b (patch) | |
tree | 97482bc8a6140aecf92971c01716a54bbe08d0c7 /sys/kern | |
parent | 6bd536a1a918bdd23db0447b16a71327a8eef7c4 (diff) |
tweak sysctl_string and sysctl_tstring to use size_t for lengths, not int
theyre both wrappers around sysctl__string, which is where half the
fix is too.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sysctl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 13024bf6ecb..16d1d279036 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.327 2017/06/13 06:16:31 dlg Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.328 2017/06/14 03:00:40 dlg Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -928,23 +928,24 @@ sysctl_rdquad(void *oldp, size_t *oldlenp, void *newp, int64_t val) */ int sysctl_string(void *oldp, size_t *oldlenp, void *newp, size_t newlen, char *str, - int maxlen) + size_t maxlen) { return sysctl__string(oldp, oldlenp, newp, newlen, str, maxlen, 0); } int sysctl_tstring(void *oldp, size_t *oldlenp, void *newp, size_t newlen, - char *str, int maxlen) + char *str, size_t maxlen) { return sysctl__string(oldp, oldlenp, newp, newlen, str, maxlen, 1); } int sysctl__string(void *oldp, size_t *oldlenp, void *newp, size_t newlen, - char *str, int maxlen, int trunc) + char *str, size_t maxlen, int trunc) { - int len, error = 0; + size_t len; + int error = 0; len = strlen(str) + 1; if (oldp && *oldlenp < len) { |