From: Masatake YAMATO Date: Wed, 1 Feb 2023 12:44:46 +0000 (+0900) Subject: tests: (mkfds) check the privilege required in the factory to run X-Git-Tag: v2.39-rc1~96^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=811ad38e6f3d4f95fe9237dde95ced33c9164f52;p=thirdparty%2Futil-linux.git tests: (mkfds) check the privilege required in the factory to run Signed-off-by: Masatake YAMATO --- diff --git a/tests/helpers/test_mkfds.c b/tests/helpers/test_mkfds.c index e37225aaf2..7f8f199f04 100644 --- a/tests/helpers/test_mkfds.c +++ b/tests/helpers/test_mkfds.c @@ -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;