summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/riff.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/riff.c b/src/riff.c
index f5c1c23..a920d10 100644
--- a/src/riff.c
+++ b/src/riff.c
@@ -284,21 +284,15 @@ error_malloc_riff:
}
static void close_file(xas_riff *riff, xas_audio_stream *stream) {
- if (lseek(riff->fd, 0, SEEK_SET) < 0) {
- goto error_io;
+ if (lseek(riff->fd, 0, SEEK_SET) == 0) {
+ (void)header_write(riff);
}
- if (header_write(riff) < 0) {
- goto error_header_write;
+ if (riff->file) {
+ (void)close(riff->fd);
}
- (void)close(riff->fd);
-
free(riff);
-
-error_header_write:
-error_io:
- return;
}
static ssize_t audio_drain(xas_riff *riff,