[alsa-devel] [PATCH alsa-lib 2/2] pcm_dmix: Fix compiler warnings -Wunused-result
Kirill Marinushkin
kmarinushkin at birdec.tech
Thu Nov 15 08:19:57 CET 2018
Before this commit, compilation of `pcm_dmix` causes warnings "ignoring
return value" for `fgets` operations:
~~~~
pcm_dmix_i386.c:108:5: warning: ignoring return value of 'fgets', declared
with attribute warn_unused_result [-Wunused-result]
fgets(line, sizeof(line), in);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~
This commit fixes the warnings.
Signed-off-by: Kirill Marinushkin <kmarinushkin at birdec.tech>
---
src/pcm/pcm_dmix_i386.c | 3 ++-
src/pcm/pcm_dmix_x86_64.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/pcm/pcm_dmix_i386.c b/src/pcm/pcm_dmix_i386.c
index 1ab983a8..81265517 100644
--- a/src/pcm/pcm_dmix_i386.c
+++ b/src/pcm/pcm_dmix_i386.c
@@ -105,7 +105,8 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
in = fopen("/proc/cpuinfo", "r");
if (in) {
while (!feof(in)) {
- fgets(line, sizeof(line), in);
+ if (!fgets(line, sizeof(line), in))
+ continue;
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 34c40d4e..c96af69b 100644
--- a/src/pcm/pcm_dmix_x86_64.c
+++ b/src/pcm/pcm_dmix_x86_64.c
@@ -88,7 +88,8 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix)
in = fopen("/proc/cpuinfo", "r");
if (in) {
while (!feof(in)) {
- fgets(line, sizeof(line), in);
+ if (!fgets(line, sizeof(line), in))
+ continue;
if (!strncmp(line, "processor", 9))
smp++;
}
--
2.13.6
More information about the Alsa-devel
mailing list