audio: Convert use of atoi to qemu_strtoi

If qemu_strtoi indicates an error, return the default value.

Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
Message-Id: <20180316144047.30904-1-nia.alarie@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Nia Alarie 2018-03-16 14:40:47 +00:00 committed by Gerd Hoffmann
parent bc753dc09f
commit 441b345313

View File

@ -335,9 +335,8 @@ static int audio_get_conf_int (const char *key, int defval, int *defaultp)
char *strval;
strval = getenv (key);
if (strval) {
if (strval && !qemu_strtoi(strval, NULL, 10, &val)) {
*defaultp = 0;
val = atoi (strval);
return val;
}
else {