richardphibel / rpms / systemd

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