diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/riff.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -78,10 +78,9 @@ static xas_riff *file_new(const char *path, goto error_malloc_riff; } - riff->fd = (flags & O_CREAT)? open(path, flags, 0644): - open(path, flags); + flags |= O_CREAT; - if (riff->fd < 0) { + if ((riff->fd = open(path, flags, 0644)) < 0) { goto error_open; } @@ -90,10 +89,8 @@ static xas_riff *file_new(const char *path, riff->sample_rate = sample_rate; riff->channels = channels; - if (flags & (O_CREAT | O_TRUNC)) { - if (header_write(riff) < 0) { - goto error_header_write; - } + if (header_write(riff) < 0) { + goto error_header_write; } return riff; |