11 Aug
2015
11 Aug
'15
3:36 p.m.
On Tue, 2015-08-11 at 09:57 +0200, Takashi Iwai wrote:
On Mon, 10 Aug 2015 20:13:49 +0200, Liam Girdwood wrote:
+int snd_tplg_build(snd_tplg_t *tplg, const char *outfile) +{
- int err;
- /* delete any old output files */
- unlink(outfile);
- tplg->out_fd =
open(outfile, O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
- if (tplg->out_fd < 0) {
SNDERR("error: failed to open %s err %d\n",
outfile, -errno);
return -errno;
- }
- err = tplg_build_integ(tplg);
- if (err < 0) {
SNDERR("error: failed to check topology integrity\n");
goto out;
- }
- err = tplg_write_data(tplg);
- if (err < 0) {
SNDERR("error: failed to write data %d\n", err);
goto out;
- }
+out:
- close(tplg->out_fd);
It's a question whether we should unlink automatically at error or not. If we leave the file as is, it should be documented.
The unlink is not really needed so I'll remove it. The file permissions should be 0600 too, so I'll fix that as well.
Liam