diff options
author | 2018-09-26 08:33:22 +0000 | |
---|---|---|
committer | 2018-09-26 08:33:22 +0000 | |
commit | 8522ebc41ac3035a480709de2deac640d46877db (patch) | |
tree | 8dde152f850b85613c2016c03d49e513b2bf2a66 /lib/libsndio/debug.c | |
parent | remove big ugly TODO comment from start of file. Some of the mentioned (diff) | |
download | wireguard-openbsd-8522ebc41ac3035a480709de2deac640d46877db.tar.xz wireguard-openbsd-8522ebc41ac3035a480709de2deac640d46877db.zip |
call _sndio_parsenum() instead of duplicating the code in parsedev(); ok ratchov@
Diffstat (limited to 'lib/libsndio/debug.c')
-rw-r--r-- | lib/libsndio/debug.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libsndio/debug.c b/lib/libsndio/debug.c index 6940ca9b909..f07ed81dfa5 100644 --- a/lib/libsndio/debug.c +++ b/lib/libsndio/debug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: debug.c,v 1.4 2015/10/02 09:48:22 ratchov Exp $ */ +/* $OpenBSD: debug.c,v 1.5 2018/09/26 08:33:22 miko Exp $ */ /* * Copyright (c) 2011 Alexandre Ratchov <alex@caoua.org> * @@ -67,13 +67,17 @@ _sndio_parsenum(const char *str, unsigned int *num, unsigned int max) dig = *p - '0'; if (dig >= 10) break; - if (val > maxq || (val == maxq && dig > maxr)) + if (val > maxq || (val == maxq && dig > maxr)) { + DPRINTF("%s: number too large\n", str); return NULL; + } val = val * 10 + dig; p++; } - if (p == str) + if (p == str) { + DPRINTF("%s: number expected\n", str); return NULL; + } *num = val; return p; } |