richardphibel / rpms / systemd

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