diff options
author | Petri Hintukainen <phintuka@users.sourceforge.net> | 2012-01-16 21:57:28 +0200 |
---|---|---|
committer | Petri Hintukainen <phintuka@users.sourceforge.net> | 2012-01-16 21:57:28 +0200 |
commit | 0629f44713df6cab71e5a648b25a831016635a09 (patch) | |
tree | 1ca0e19bda64786525d8728a3ad030b82a580a2b | |
parent | c183aac00525f9b15efb7a20bf984af68e40d87a (diff) | |
download | xine-lib-0629f44713df6cab71e5a648b25a831016635a09.tar.gz xine-lib-0629f44713df6cab71e5a648b25a831016635a09.tar.bz2 |
Check for failed write
-rw-r--r-- | src/audio_out/audio_file_out.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c index 802461e0e..bc40d4efd 100644 --- a/src/audio_out/audio_file_out.c +++ b/src/audio_out/audio_file_out.c @@ -274,10 +274,20 @@ static void ao_file_close(ao_driver_t *this_gen) this->fname, this->bytes_written / 1024); if (lseek(this->fd, 40, SEEK_SET) != -1) { - write(this->fd, &len, 4); + if (write(this->fd, &len, 4) != 4) { + xprintf (this->xine, XINE_VERBOSITY_LOG, "audio_file_out: Failed to write header to file '%s': %s\n", + this->fname, strerror(errno)); + } + len = le2me_32(this->bytes_written + 0x24); - if (lseek(this->fd, 4, SEEK_SET) != -1) - write(this->fd, &len, 4); + if (lseek(this->fd, 4, SEEK_SET) != -1) { + if (write(this->fd, &len, 4) != 4) { + xprintf (this->xine, XINE_VERBOSITY_LOG, + "audio_file_out: Failed to write header to file '%s': %s\n", + this->fname, strerror(errno)); + } + } + } close(this->fd); |