]> err.no Git - systemd/commitdiff
tmpfiles: open directories with O_NOATIME to preserve timestamp
authorKay Sievers <kay@vrfy.org>
Wed, 11 Apr 2012 19:33:12 +0000 (21:33 +0200)
committerKay Sievers <kay@vrfy.org>
Wed, 11 Apr 2012 19:40:25 +0000 (21:40 +0200)
Before:
  # stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
  Access: 2012-04-11 21:32:48.444920237 +0200
  # systemd-tmpfiles --clean
  # stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
  Access: 2012-04-11 21:36:27.628925459 +0200

After:
  # stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
  Access: 2012-04-11 21:32:48.444920237 +0200
  # ./systemd-tmpfiles --clean
  # stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
  Access: 2012-04-11 21:32:48.444920237 +0200

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=810257
src/tmpfiles.c

index 5e85e37411b55ea22a4f83d4a37a7aaa5858f345..c5f6fc00b30a7667aa793ac899be7fc1038a5aa2 100644 (file)
@@ -269,7 +269,7 @@ static int dir_cleanup(
                                 DIR *sub_dir;
                                 int q;
 
-                                sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW);
+                                sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW|O_NOATIME);
                                 if (sub_dir == NULL) {
                                         if (errno != ENOENT) {
                                                 log_error("opendir(%s/%s) failed: %m", p, dent->d_name);