mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 03:04:34 +01:00
mv: Set file flags after setting file times
Some file flags prevent modification of file times, so they should be set later. This matches NetBSD's behaviour. Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1138
This commit is contained in:
parent
219d8fb036
commit
428f86fd2f
11
bin/mv/mv.c
11
bin/mv/mv.c
@ -319,6 +319,12 @@ err: if (unlink(to))
|
|||||||
*/
|
*/
|
||||||
preserve_fd_acls(from_fd, to_fd, from, to);
|
preserve_fd_acls(from_fd, to_fd, from, to);
|
||||||
(void)close(from_fd);
|
(void)close(from_fd);
|
||||||
|
|
||||||
|
ts[0] = sbp->st_atim;
|
||||||
|
ts[1] = sbp->st_mtim;
|
||||||
|
if (futimens(to_fd, ts))
|
||||||
|
warn("%s: set times", to);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX
|
* XXX
|
||||||
* NFS doesn't support chflags; ignore errors unless there's reason
|
* NFS doesn't support chflags; ignore errors unless there's reason
|
||||||
@ -339,11 +345,6 @@ err: if (unlink(to))
|
|||||||
} else
|
} else
|
||||||
warn("%s: cannot stat", to);
|
warn("%s: cannot stat", to);
|
||||||
|
|
||||||
ts[0] = sbp->st_atim;
|
|
||||||
ts[1] = sbp->st_mtim;
|
|
||||||
if (futimens(to_fd, ts))
|
|
||||||
warn("%s: set times", to);
|
|
||||||
|
|
||||||
if (close(to_fd)) {
|
if (close(to_fd)) {
|
||||||
warn("%s", to);
|
warn("%s", to);
|
||||||
return (1);
|
return (1);
|
||||||
|
Loading…
Reference in New Issue
Block a user