teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0515-udev-test-check-if-permitted-to-create-block-device-.patch

21255d
From 57e9ee0f19098d56995955f6692437affdf94041 Mon Sep 17 00:00:00 2001
21255d
From: Alexey Bogdanenko <alexey@bogdanenko.com>
21255d
Date: Tue, 11 Dec 2018 16:55:34 +0300
21255d
Subject: [PATCH] udev-test: check if permitted to create block device nodes
21255d
21255d
(cherry picked from commit dbfbc6c4e34366033cb340e8b0c3cbca683ff6f5)
21255d
21255d
Related: #1642728
21255d
---
21255d
 test/udev-test.pl | 8 ++++++++
21255d
 1 file changed, 8 insertions(+)
21255d
21255d
diff --git a/test/udev-test.pl b/test/udev-test.pl
21255d
index eb76ebd72e..957cda541c 100755
21255d
--- a/test/udev-test.pl
21255d
+++ b/test/udev-test.pl
21255d
@@ -1554,6 +1554,14 @@ sub udev_setup {
21255d
                 return 0;
21255d
         }
21255d
 
21255d
+        # check if we are permitted to create block device nodes
21255d
+        my $block_device_filename = $udev_dev . "/sda";
21255d
+        if (system("mknod", $block_device_filename, "b", "8", "0")) {
21255d
+                warn "unable to create $block_device_filename";
21255d
+                return 0;
21255d
+        }
21255d
+        unlink $block_device_filename;
21255d
+
21255d
         system("cp", "-r", "test/sys/", $udev_sys) && die "unable to copy test/sys";
21255d
 
21255d
         system("rm", "-rf", "$udev_run");