When doing a -S "safe copy", the install command should do an
fsync(2) system call after copying the installed file to ensure that it is on stable storage. PR: 230851 Reviewed by: kib Approved by: re (marius)
This commit is contained in:
parent
abf44e17e8
commit
d3e21e1e4a
@ -1265,6 +1265,12 @@ copy(int from_fd, const char *from_name, int to_fd, const char *to_name,
|
||||
err(EX_OSERR, "%s", from_name);
|
||||
}
|
||||
}
|
||||
if (safecopy && fsync(to_fd) == -1) {
|
||||
serrno = errno;
|
||||
(void)unlink(to_name);
|
||||
errno = serrno;
|
||||
err(EX_OSERR, "fsync failed for %s", to_name);
|
||||
}
|
||||
return (digest_end(&ctx, NULL));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user