summaryrefslogtreecommitdiffstats
path: root/debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch')
-rw-r--r--debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch b/debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch
new file mode 100644
index 0000000..e3f1c64
--- /dev/null
+++ b/debian/patches/debian/Revert-udev-link_update-should-fail-if-the-entry-in-symli.patch
@@ -0,0 +1,47 @@
+From: Michael Biebl <biebl@debian.org>
+Date: Sat, 25 Sep 2021 21:08:26 +0200
+Subject: Revert "udev: link_update() should fail if the entry in symlink dir
+ couldn't have been created"
+
+This reverts commit c07dc6cedc6e6fbc28a0da3e8c8b12900423b409.
+---
+ src/udev/udev-node.c | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
+index 2cc78c9..bde18f7 100644
+--- a/src/udev/udev-node.c
++++ b/src/udev/udev-node.c
+@@ -214,23 +214,20 @@ static int link_update(sd_device *dev, const char *slink, bool add) {
+ if (!filename)
+ return log_oom();
+
+- if (!add) {
+- if (unlink(filename) == 0)
+- (void) rmdir(dirname);
+- } else
+- for (;;) {
++ if (!add && unlink(filename) == 0)
++ (void) rmdir(dirname);
++
++ if (add)
++ do {
+ _cleanup_close_ int fd = -1;
+
+ r = mkdir_parents(filename, 0755);
+ if (!IN_SET(r, 0, -ENOENT))
+- return r;
+-
+- fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
+- if (fd >= 0)
+ break;
+- if (errno != ENOENT)
+- return -errno;
+- }
++ fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444);
++ if (fd < 0)
++ r = -errno;
++ } while (r == -ENOENT);
+
+ /* If the database entry is not written yet we will just do one iteration and possibly wrong symlink
+ * will be fixed in the second invocation. */