fdio: Delete .tmp file on failure

We noticed the temp files being left over in ostree when (mistakenly)
trying to replace the contents of a subpath that wasn't a directory.

In the future we should look at the systemd code using `O_TMPFILE`
here.
This commit is contained in:
Yu Qi Zhang
2016-06-16 15:39:32 +00:00
committed by Colin Walters
parent afe3c3a861
commit a6d08657aa

View File

@@ -746,6 +746,8 @@ glnx_file_replace_contents_with_perms_at (int dfd,
ret = TRUE;
out:
if (!ret)
(void) unlink (tmppath);
return ret;
}