summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2004-02-29 00:23:16 +0000
committerMartin Schlemmer <azarah@gentoo.org>2004-02-29 00:23:16 +0000
commit11b2c9169128daea146a9ec33367bf16397273e2 (patch)
treea815c885337c4ea1dcd325698544cb376e3c84b4 /sys-fs/udev/files
parentadd gnome-vfs dep (#43095) (Manifest recommit) (diff)
downloadgentoo-2-11b2c9169128daea146a9ec33367bf16397273e2.tar.gz
gentoo-2-11b2c9169128daea146a9ec33367bf16397273e2.tar.bz2
gentoo-2-11b2c9169128daea146a9ec33367bf16397273e2.zip
Remove existing file first before creating node/symlink (bug #43151).
Diffstat (limited to 'sys-fs/udev/files')
-rw-r--r--sys-fs/udev/files/digest-udev-019-r11
-rw-r--r--sys-fs/udev/files/udev-019-unlink-existing.patch64
2 files changed, 65 insertions, 0 deletions
diff --git a/sys-fs/udev/files/digest-udev-019-r1 b/sys-fs/udev/files/digest-udev-019-r1
new file mode 100644
index 000000000000..260838209a00
--- /dev/null
+++ b/sys-fs/udev/files/digest-udev-019-r1
@@ -0,0 +1 @@
+MD5 83bf597bffec749cc89686aadb3218ef udev-019.tar.bz2 316828
diff --git a/sys-fs/udev/files/udev-019-unlink-existing.patch b/sys-fs/udev/files/udev-019-unlink-existing.patch
new file mode 100644
index 000000000000..fa5e09538fc9
--- /dev/null
+++ b/sys-fs/udev/files/udev-019-unlink-existing.patch
@@ -0,0 +1,64 @@
+--- udev-019/udev-add.c.orig 2004-02-29 01:06:08.867518640 +0200
++++ udev-019/udev-add.c 2004-02-29 01:12:55.516698568 +0200
+@@ -132,9 +132,27 @@ static int make_node(char *filename, int
+ return 0;
+ }
+
+-static int create_node(struct udevice *dev, int fake)
++static int unlink_entry(char *filename, int fake)
+ {
+ struct stat stats;
++ int retval;
++
++ if (!fake && (lstat(filename, &stats) == 0)) {
++ if ((stats.st_mode & S_IFMT) != S_IFDIR) {
++ retval = unlink(filename);
++ if (retval) {
++ dbg("unlink(%s) failed with error '%s'",
++ filename, strerror(errno));
++ return retval;
++ }
++ }
++ }
++
++ return 0;
++}
++
++static int create_node(struct udevice *dev, int fake)
++{
+ char filename[255];
+ char linktarget[255];
+ char partitionname[255];
+@@ -198,6 +216,8 @@ static int create_node(struct udevice *d
+ }
+
+ if (!fake) {
++ /* unlink existing files to ensure that our symlink is created */
++ unlink_entry(filename, fake);
+ info("creating device node '%s'", filename);
+ make_node(filename, dev->major, dev->minor, dev->mode, uid, gid);
+ } else {
+@@ -212,6 +232,8 @@ static int create_node(struct udevice *d
+ if (!fake) {
+ for (i = 1; i <= dev->partitions; i++) {
+ sprintf(partitionname, "%s%i", filename, i);
++ /* unlink existing files to ensure that our symlink is created */
++ unlink_entry(partitionname, fake);
+ make_node(partitionname, dev->major,
+ dev->minor + i, dev->mode, uid, gid);
+ }
+@@ -254,13 +276,7 @@ static int create_node(struct udevice *d
+ strfieldcat(linktarget, &dev->name[tail]);
+
+ /* unlink existing files to ensure that our symlink is created */
+- if (!fake && (lstat(filename, &stats) == 0)) {
+- if ((stats.st_mode & S_IFMT) != S_IFDIR) {
+- if (unlink(filename))
+- dbg("unlink(%s) failed with error '%s'",
+- filename, strerror(errno));
+- }
+- }
++ unlink_entry(filename, fake);
+
+ dbg("symlink(%s, %s)", linktarget, filename);
+ if (!fake) {