chiark / gitweb /
update mtime of nodes and links when we re-use them
authorKay Sievers <kay.sievers@vrfy.org>
Fri, 18 Dec 2009 20:25:13 +0000 (21:25 +0100)
committerKay Sievers <kay.sievers@vrfy.org>
Fri, 18 Dec 2009 20:25:13 +0000 (21:25 +0100)
udev/udev-node.c

index 24f2ccf618cd14592c3762640b76fd168521e4df..c80a74c2188128eb20478f4d137b0b89855975da 100644 (file)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <grp.h>
 #include <dirent.h>
 #include <errno.h>
 #include <grp.h>
 #include <dirent.h>
+#include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
 #include <sys/stat.h>
 #include <sys/types.h>
 
@@ -55,6 +56,8 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
                        info(udev, "preserve file '%s', because it has correct dev_t\n", file);
                        preserve = 1;
                        udev_selinux_lsetfilecon(udev, file, mode);
                        info(udev, "preserve file '%s', because it has correct dev_t\n", file);
                        preserve = 1;
                        udev_selinux_lsetfilecon(udev, file, mode);
+                       /* update time stamp when we re-use the node, like on media change events */
+                       utimes(file, NULL);
                } else {
                        char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
 
                } else {
                        char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
 
@@ -175,6 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
                                        info(udev, "preserve already existing symlink '%s' to '%s'\n",
                                             slink, target);
                                        udev_selinux_lsetfilecon(udev, slink, S_IFLNK);
                                        info(udev, "preserve already existing symlink '%s' to '%s'\n",
                                             slink, target);
                                        udev_selinux_lsetfilecon(udev, slink, S_IFLNK);
+                                       lutimes(slink, NULL);
                                        goto exit;
                                }
                        }
                                        goto exit;
                                }
                        }