Ignore:
Timestamp:
Jan 8, 2019, 6:51:16 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
Children:
057ecee, 982629c, ef8a1e4, f862b85
Parents:
ba9e3a8
Message:

[sink_wavwrite] call fflush in open

This ensures the file header was actually written correctly, and fails
otherwise, for instance when the target disk-system is full.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_wavwrite.c

    rba9e3a8 r65a4fb4  
    212212
    213213  // fwrite(*, *, 1, s->fid) was called 13 times, check success
    214   if (written != 13) {
    215     AUBIO_STRERR("sink_wavwrite: writing header to %s failed, expected %d"
    216         " write but got only %d (%s)\n", s->path, 13, written, errorstr);
     214  if (written != 13 || fflush(s->fid)) {
     215    AUBIO_STRERR("sink_wavwrite: writing header to %s failed"
     216        " (wrote %d/%d, %s)\n", s->path, written, 13, errorstr);
     217    fclose(s->fid);
     218    s->fid = NULL;
    217219    return AUBIO_FAIL;
    218220  }
Note: See TracChangeset for help on using the changeset viewer.