diff options
| author | XANTRONIX Development | 2022-02-01 13:18:21 -0500 | 
|---|---|---|
| committer | XANTRONIX Development | 2022-02-01 13:18:21 -0500 | 
| commit | 7c9e074e8731efcd453da61d7aa2d7f68c587632 (patch) | |
| tree | 9af2c990590af7d494b338866e943108350db6ef /src | |
| parent | d10d683326161d6570eb4b905dc645a95551869f (diff) | |
| download | xas-7c9e074e8731efcd453da61d7aa2d7f68c587632.tar.gz xas-7c9e074e8731efcd453da61d7aa2d7f68c587632.tar.bz2 xas-7c9e074e8731efcd453da61d7aa2d7f68c587632.zip | |
Make xas_riff_file_new() always write header
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; | 
 
    