---
 libutil/cp.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libutil/cp.c b/libutil/cp.c
index 15e4ce5..f89319d 100644
--- a/libutil/cp.c
+++ b/libutil/cp.c
@@ -139,13 +139,13 @@ cp(const char *s1, const char *s2, int depth)
        }
 
        if (cp_aflag || cp_pflag) {
+               times[0] = st.st_atim;
+               times[1] = st.st_mtim;
+               if (utimensat(AT_FDCWD, s2, times, AT_SYMLINK_NOFOLLOW) < 0) {
+                       weprintf("utimensat %s:", s2);
+                       cp_status = 1;
+               }
                if (!S_ISLNK(st.st_mode)) {
-                       times[0] = st.st_atim;
-                       times[1] = st.st_mtim;
-                       if (utimensat(AT_FDCWD, s2, times, 0) < 0) {
-                               weprintf("utimensat %s:", s2);
-                               cp_status = 1;
-                       }
                        if (chown(s2, st.st_uid, st.st_gid) < 0) {
                                weprintf("chown %s:", s2);
                                cp_status = 1;
-- 
2.10.2


Reply via email to