A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

fix yellow by acknowledging the fread() return code and also allow gigabeat_s_code() to actually return an error code if it fails


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21084 a1c6a512-1295-4272-9138-f99709370657

+11 -5
+10 -3
tools/gigabeats.c
··· 74 74 unsigned int size; 75 75 unsigned int newsize; 76 76 unsigned char* buf; 77 + size_t rc; 77 78 78 79 in = openinfile(infile); 79 80 out = openoutfile(outfile); ··· 87 88 newsize = 15 + 16 + 12 + size + 12; 88 89 buf = malloc(newsize); 89 90 if(buf == NULL) { 90 - fprintf(stderr, "Not enough memory to perform the requested operation. Aborting.\n" ); 91 - return 0; 91 + fprintf(stderr, 92 + "Not enough memory to perform the operation. Aborting.\n" ); 93 + return 1; 92 94 } 93 95 fseek(in, 0, SEEK_SET); 94 - fread(buf + 43, size, 1, in); 96 + rc = fread(buf + 43, 1, size, in); 95 97 fclose(in); 96 98 99 + if(rc != size) { 100 + /* failed to read the wanted amount */ 101 + fprintf(stderr, "Failed reading from %s.\n", infile); 102 + return 2; 103 + } 97 104 /* Step 2: Create the file header */ 98 105 sprintf((char *)buf, "B000FF\n"); 99 106 put_uint32le(0x88200000, buf+7);
+1 -2
tools/scramble.c
··· 329 329 else if(!strcmp(argv[1], "-gigabeats")) { 330 330 iname = argv[2]; 331 331 oname = argv[3]; 332 - gigabeat_s_code(iname, oname); 333 - return 0; 332 + return gigabeat_s_code(iname, oname); 334 333 } 335 334 else if(!strcmp(argv[1], "-iaudiox5")) { 336 335 iname = argv[2];