]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fs-util: use futimens_opath() helper function
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 2 Sep 2021 03:05:33 +0000 (12:05 +0900)
committerVito Caputo <vcaputo@pengaru.com>
Thu, 2 Sep 2021 04:36:36 +0000 (21:36 -0700)
src/basic/fs-util.c

index cc8c5e1c3ec5f57870c6ed31037a177d2daf45cc..165dffbefa8357f326d513285b091e16e833369c 100644 (file)
@@ -412,11 +412,11 @@ int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gi
 
                 timespec_store(&ts[0], stamp);
                 ts[1] = ts[0];
-                r = utimensat(AT_FDCWD, FORMAT_PROC_FD_PATH(fd), ts, 0);
+                r = futimens_opath(fd, ts);
         } else
-                r = utimensat(AT_FDCWD, FORMAT_PROC_FD_PATH(fd), NULL, 0);
+                r = futimens_opath(fd, NULL);
         if (r < 0 && ret >= 0)
-                return -errno;
+                return r;
 
         return ret;
 }