summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2020-03-25 19:26:53 +0000
committercheloha <cheloha@cvs.openbsd.org>2020-03-25 19:26:53 +0000
commit0aa5331262a34fc54cb5ab165e8c4761fa6c7e8b (patch)
tree5a2e83592447140ce45232475a45e984a61f3a3d
parent38d4b50dde21962d7bf053beb912f843b1beba3d (diff)
init(8): use err(3) instead of hand-rolled fprintf(3) messages
-rw-r--r--sbin/init/init.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index b23c6fd1f48..72d929706d3 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.69 2019/06/28 13:32:44 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.70 2020/03/25 19:26:52 cheloha Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -195,16 +195,12 @@ main(int argc, char *argv[])
sigset_t mask;
/* Dispose of random users. */
- if (getuid() != 0) {
- (void)fprintf(stderr, "init: %s\n", strerror(EPERM));
- exit (1);
- }
+ if (getuid() != 0)
+ errc(1, EPERM, NULL);
/* System V users like to reexec init. */
- if (getpid() != 1) {
- (void)fprintf(stderr, "init: already running\n");
- exit (1);
- }
+ if (getpid() != 1)
+ errx(1, "already running");
/*
* Paranoia.