Date: Thu, 25 Apr 2024 13:20:55 GMT From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: eff68b69dfa2 - stable/14 - mv: Set file flags after setting file times Message-ID: <202404251320.43PDKtwP001728@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=eff68b69dfa234f757b370b46596f7c8d604e05d commit eff68b69dfa234f757b370b46596f7c8d604e05d Author: Ricardo Branco <rbranco@suse.de> AuthorDate: 2024-03-16 17:13:10 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2024-04-25 13:20:16 +0000 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 (cherry picked from commit 428f86fd2ff1fd2b073d556fac273c8c7f457376) --- bin/mv/mv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 1320f603b3c4..dba71f55e5dc 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -331,6 +331,12 @@ err: if (unlink(to)) */ preserve_fd_acls(from_fd, to_fd, from, to); (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 * NFS doesn't support chflags; ignore errors unless there's reason @@ -351,11 +357,6 @@ err: if (unlink(to)) } else 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)) { warn("%s", to); return (1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404251320.43PDKtwP001728>