pcm: Add error handler for fgets

This commit is contained in:
Tomohiro IKEDA 2022-06-15 08:45:19 +09:00
parent 89ee619147
commit 0ec7450a8b
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++;
}