[alsa-devel] [PATCH 1/2] cplay: fix size and nmemb of mp3 header of fread

Katsuhiro Suzuki suzuki.katsuhiro at socionext.com
Tue Jan 23 03:33:11 CET 2018


This patch swaps 'size' and 'nmemb' arguments of fread.
The fread returns always 1 (because 'nmemb' is 1) so checking
the return value is always failure.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro at socionext.com>
---
 src/utils/cplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/utils/cplay.c b/src/utils/cplay.c
index e0603fd..bc95f0d 100644
--- a/src/utils/cplay.c
+++ b/src/utils/cplay.c
@@ -220,7 +220,7 @@ void play_samples(char *name, unsigned int card, unsigned int device,
 		exit(EXIT_FAILURE);
 	}
 
-	read = fread(&header, sizeof(header), 1, file);
+	read = fread(&header, 1, sizeof(header), file);
 	if (read != sizeof(header)) {
 		fprintf(stderr, "Unable to read header \n");
 		fclose(file);
-- 
2.15.0



More information about the Alsa-devel mailing list