cp,mv: Use futimens() instead of utimensat() if possible.
This commit is contained in:
parent
f0c61ded93
commit
347b9f6de0
@ -342,7 +342,7 @@ setfile(struct stat *fs, int fd)
|
|||||||
|
|
||||||
tspec[0] = fs->st_atim;
|
tspec[0] = fs->st_atim;
|
||||||
tspec[1] = fs->st_mtim;
|
tspec[1] = fs->st_mtim;
|
||||||
if (utimensat(AT_FDCWD, to.p_path, tspec,
|
if (fdval ? futimens(fd, tspec) : utimensat(AT_FDCWD, to.p_path, tspec,
|
||||||
islink ? AT_SYMLINK_NOFOLLOW : 0)) {
|
islink ? AT_SYMLINK_NOFOLLOW : 0)) {
|
||||||
warn("utimensat: %s", to.p_path);
|
warn("utimensat: %s", to.p_path);
|
||||||
rval = 1;
|
rval = 1;
|
||||||
|
@ -352,7 +352,7 @@ err: if (unlink(to))
|
|||||||
|
|
||||||
ts[0] = sbp->st_atim;
|
ts[0] = sbp->st_atim;
|
||||||
ts[1] = sbp->st_mtim;
|
ts[1] = sbp->st_mtim;
|
||||||
if (utimensat(AT_FDCWD, to, ts, 0))
|
if (futimens(to_fd, ts))
|
||||||
warn("%s: set times", to);
|
warn("%s: set times", to);
|
||||||
|
|
||||||
if (close(to_fd)) {
|
if (close(to_fd)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user