Changeset 65a4fb4


Ignore:
Timestamp:
Jan 8, 2019, 6:51:16 PM (7 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/timestretch, master
Children:
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.