diff options
author | miko <miko@cvs.openbsd.org> | 2018-09-26 08:33:23 +0000 |
---|---|---|
committer | miko <miko@cvs.openbsd.org> | 2018-09-26 08:33:23 +0000 |
commit | c39bfabbd4542ab1ef2ae6dd15329cecf298fe02 (patch) | |
tree | 3c562d787d3c7e5c11dd8d4662fd75161a6144ca /lib/libsndio/debug.c | |
parent | 71adb5439b0c09c4a1760ecd1fa16ead3c7e621d (diff) |
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; } |