]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: (mkfds) check the privilege required in the factory to run
authorMasatake YAMATO <yamato@redhat.com>
Wed, 1 Feb 2023 12:44:46 +0000 (21:44 +0900)
committerMasatake YAMATO <yamato@redhat.com>
Thu, 2 Feb 2023 14:16:18 +0000 (23:16 +0900)
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
tests/helpers/test_mkfds.c

index e37225aaf27af73d069654d88f32e84c901e8930..7f8f199f04ede2ca16e2e3271df6bbd4dd28398b 100644 (file)
@@ -2065,6 +2065,9 @@ int main(int argc, char **argv)
                errx(EXIT_FAILURE, _("not enough file descriptors given for %s"),
                     factory->name);
 
+       if (factory->priv && getuid() != 0)
+               errx(EXIT_FAILURE, "%s factory requires root privilege", factory->name);
+
        for (int i = 0; i < MAX_N; i++) {
                fdescs[i].fd = -1;
                fdescs[i].close = NULL;