summaryrefslogtreecommitdiff
path: root/udev_node.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-06-25 16:03:11 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-06-25 16:03:11 +0200
commit14c7994263150b01d7ffbf89969cf8e3df893dc8 (patch)
tree822c94eb00c6e2da325814b8aaf471d2217e4cba /udev_node.c
parentc51d06d3b7e3209d5cf695de05aa25707f66780b (diff)
always unlink temporary file before creating new one
Diffstat (limited to 'udev_node.c')
-rw-r--r--udev_node.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/udev_node.c b/udev_node.c
index 9e09e58ba8..fcd52d0e45 100644
--- a/udev_node.c
+++ b/udev_node.c
@@ -63,6 +63,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m
info("atomically replace '%s'", file);
strlcpy(file_tmp, file, sizeof(file_tmp));
strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp));
+ unlink(file_tmp);
selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode);
retval = mknod(file_tmp, mode, devt);
selinux_resetfscreatecon();
@@ -162,6 +163,7 @@ static int node_symlink(const char *node, const char *slink)
info("atomically replace '%s'", slink);
strlcpy(slink_tmp, slink, sizeof(slink_tmp));
strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp));
+ unlink(slink_tmp);
selinux_setfscreatecon(slink_tmp, NULL, S_IFLNK);
retval = symlink(target, slink_tmp);
selinux_resetfscreatecon();