fs-util: Drop unlink_noerrno()

This commit is contained in:
Daan De Meyer
2023-03-15 13:27:20 +01:00
parent a45332500d
commit 39eb3ffaaa
6 changed files with 12 additions and 36 deletions
+5 -4
View File
@@ -262,13 +262,14 @@ static int copy_file_with_version_check(const char *from, const char *to, bool f
r = fsync_full(fd_to);
if (r < 0) {
(void) unlink_noerrno(t);
(void) unlink(t);
return log_error_errno(r, "Failed to copy data from \"%s\" to \"%s\": %m", from, t);
}
if (renameat(AT_FDCWD, t, AT_FDCWD, to) < 0) {
(void) unlink_noerrno(t);
return log_error_errno(errno, "Failed to rename \"%s\" to \"%s\": %m", t, to);
r = RET_NERRNO(renameat(AT_FDCWD, t, AT_FDCWD, to));
if (r < 0) {
(void) unlink(t);
return log_error_errno(r, "Failed to rename \"%s\" to \"%s\": %m", t, to);
}
log_info("Copied \"%s\" to \"%s\".", from, to);