From e8ac57cadd387e91d1c0ce5773f7f17305d299eb Mon Sep 17 00:00:00 2001 From: Alexey Gladkov Date: Thu, 16 Dec 2021 22:07:13 +0300 Subject: ALT: Change the error message when the getuid check fails --- man/halt.8 | 2 +- src/halt.c | 2 +- src/init.c | 2 +- src/shutdown.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/man/halt.8 b/man/halt.8 index 6f94e02..dc431f9 100644 --- a/man/halt.8 +++ b/man/halt.8 @@ -88,7 +88,7 @@ called as \fBpoweroff\fP. .\"}}} .\"{{{ Diagnostics .SH DIAGNOSTICS -If you're not the superuser, you will get the message `must be superuser'. +If you're not the superuser, you will get the message `operation not permitted'. .\"}}} .\"{{{ Notes .SH NOTES diff --git a/src/halt.c b/src/halt.c index c578c7e..c633033 100644 --- a/src/halt.c +++ b/src/halt.c @@ -243,7 +243,7 @@ int main(int argc, char **argv) if (argc != optind) usage(); if (geteuid() != 0) { - fprintf(stderr, "%s: must be superuser.\n", progname); + fprintf(stderr, "%s: operation not permitted.\n", progname); exit(1); } diff --git a/src/init.c b/src/init.c index 629302d..64b7c92 100644 --- a/src/init.c +++ b/src/init.c @@ -3110,7 +3110,7 @@ int main(int argc, char **argv) /* Quick check */ if (geteuid() != 0) { - fprintf(stderr, "%s: must be superuser.\n", + fprintf(stderr, "%s: operation not permitted.\n", program_invocation_short_name); exit(1); } diff --git a/src/shutdown.c b/src/shutdown.c index fccf2eb..11f6dcd 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -544,7 +544,7 @@ int main(int argc, char **argv) } if (getuid() != 0) { - fprintf(stderr, "shutdown: you must be root to do that!\n"); + fprintf(stderr, "shutdown: operation not permitted.\n"); usage(); exit(1); } -- 2.25.4