Ticket #5150: programs_mythtranscode_replex_replex.c-check-save_read-count-in-init_replex.patch

File programs_mythtranscode_replex_replex.c-check-save_read-count-in-init_replex.patch, 994 bytes (added by Erik Hovland <erik@…>, 13 years ago)

check save_read for errors and report

  • programs/mythtranscode/replex/replex.c

    init_index does a magic 12 byte call to save_read but doesn't check to see if it worked.
    
    From: Erik Hovland <erik@hovland.org>
    
    It really should.
    ---
    
     programs/mythtranscode/replex/replex.c |    8 +++++++-
     1 files changed, 7 insertions(+), 1 deletions(-)
    
    diff --git a/programs/mythtranscode/replex/replex.c b/programs/mythtranscode/replex/replex.c
    index 13b5d50..dfea4e6 100644
    a b void init_replex(struct replex *rx) 
    18351835                avi_context *ac;
    18361836                uint8_t buf[AVI_S];
    18371837                int re=0;
     1838                ssize_t read_count = 0;
    18381839               
    18391840                lseek(rx->fd_in, 0, SEEK_SET);
    18401841                ac = &rx->ac;
    18411842                memset(ac, 0, sizeof(avi_context));
    1842                 save_read(rx, buf, 12);
     1843                if ((read_count = save_read(rx, buf, 12)) != 12) {
     1844                        fprintf(stderr,
     1845                                "Error reading in 12 bytes from replex. Read %d bytes\n",
     1846                                read_count);
     1847                        exit(1);
     1848                }
    18431849               
    18441850                if (check_riff(ac, buf, 12) < 0){
    18451851                        fprintf(stderr, "Wrong RIFF header\n");