At the time of target file check, .tmp file is already created and file
lock is held, so we should remove the .tmp, like in other error paths.
With this, piglit no longer leaves large amount of empty .tmp files
behind, which waste directory entries and may interfere with eviction.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
* (to ensure the size accounting of the cache doesn't get off).
*/
fd_final = open(filename, O_RDONLY | O_CLOEXEC);
- if (fd_final != -1)
+ if (fd_final != -1) {
+ unlink(filename_tmp);
goto done;
+ }
/* OK, we're now on the hook to write out a file that we know is
* not in the cache, and is also not being written out to the cache