[PATCH alsa-lib 2/2] pcm_dmix: Fix compiler warnings -Wunused-result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux