diff --git a/bin/mv/mv.c b/bin/mv/mv.c index 7a1ecba7e076..8aea4bbf567c 100644 --- a/bin/mv/mv.c +++ b/bin/mv/mv.c @@ -319,6 +319,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 @@ -339,11 +345,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);