topology: check for the remove() error (coverity)

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-06-09 10:31:50 +02:00
parent 9ffc427802
commit 1dd37fddd8

View file

@ -183,7 +183,9 @@ static int save(const char *output_file, void *buf, size_t size)
if (r < 0) { if (r < 0) {
fprintf(stderr, _("Write error: %s\n"), strerror(-errno)); fprintf(stderr, _("Write error: %s\n"), strerror(-errno));
if (fd != fileno(stdout)) { if (fd != fileno(stdout)) {
remove(fname); if (fname && remove(fname))
fprintf(stderr, _("Unable to remove file %s: %s\n"),
fname, strerror(-errno));
close(fd); close(fd);
} }
return 1; return 1;