diff --git a/src/pcm/pcm_dmix_i386.c b/src/pcm/pcm_dmix_i386.c index 82a91c5c..ea55d8ec 100644 --- a/src/pcm/pcm_dmix_i386.c +++ b/src/pcm/pcm_dmix_i386.c @@ -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)) { diff --git a/src/pcm/pcm_dmix_x86_64.c b/src/pcm/pcm_dmix_x86_64.c index 4d882bfd..1c80e181 100644 --- a/src/pcm/pcm_dmix_x86_64.c +++ b/src/pcm/pcm_dmix_x86_64.c @@ -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++; }