pcm_file: call pclose() correctly for popen() (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-05-24 11:09:43 +02:00
parent d5a1cf35b7
commit 22ade9b8c1

View file

@ -227,7 +227,14 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
file->final_fname); file->final_fname);
return -errno; return -errno;
} }
fd = fileno(pipe); fd = dup(fileno(pipe));
err = -errno;
pclose(pipe);
if (fd < 0) {
SYSERR("unable to dup pipe file handle for command %s",
file->final_fname);
return err;
}
} else { } else {
if (file->trunc) if (file->trunc)
fd = open(file->final_fname, O_WRONLY|O_CREAT|O_TRUNC, fd = open(file->final_fname, O_WRONLY|O_CREAT|O_TRUNC,