diff mbox

[1/2] cplay: fix size and nmemb of mp3 header of fread

Message ID 20180123023312.13029-1-suzuki.katsuhiro@socionext.com (mailing list archive)
State New, archived
Headers show

Commit Message

Katsuhiro Suzuki Jan. 23, 2018, 2:33 a.m. UTC
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@socionext.com>
---
 src/utils/cplay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Vinod Koul Feb. 1, 2018, 10:53 a.m. UTC | #1
On Tue, Jan 23, 2018 at 11:33:11AM +0900, Katsuhiro Suzuki wrote:
> 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.

Applied, thanks
diff mbox

Patch

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);