pcm: dmix - Add error handler for fgets

Fixes: https://github.com/alsa-project/alsa-lib/pull/238
Signed-off-by: Tomohiro IKEDA <rilakkuma.san.xjapan@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Tomohiro IKEDA 2022-06-15 08:45:19 +09:00 committed by Jaroslav Kysela
parent 2d56ff8ded
commit ff0db96bbc
2 changed files with 2 additions and 4 deletions

View file

@ -104,8 +104,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
/* try to determine the capabilities of the CPU */
in = fopen("/proc/cpuinfo", "r");
if (in) {
while (!feof(in)) {
fgets(line, sizeof(line), in);
while (!feof(in) && (fgets(line, sizeof(line), in) != NULL)) {
if (!strncmp(line, "processor", 9))
smp++;
else if (!strncmp(line, "flags", 5)) {

View file

@ -87,8 +87,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
/* try to determine, if we have SMP */
in = fopen("/proc/cpuinfo", "r");
if (in) {
while (!feof(in)) {
fgets(line, sizeof(line), in);
while (!feof(in) && (fgets(line, sizeof(line), in) != NULL)) {
if (!strncmp(line, "processor", 9))
smp++;
}