init.c (24408) | init.c (26594) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Donn Seeley at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Donn Seeley at Berkeley Software Design, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. |
35 * 36 * $Id$ |
|
35 */ 36 37#ifndef lint 38static char copyright[] = 39"@(#) Copyright (c) 1991, 1993\n\ 40 The Regents of the University of California. All rights reserved.\n"; 41#endif /* not lint */ 42 --- 13 unchanged lines hidden (view full) --- 56#include <stdio.h> 57#include <stdlib.h> 58#include <string.h> 59#include <syslog.h> 60#include <time.h> 61#include <ttyent.h> 62#include <unistd.h> 63#include <sys/reboot.h> | 37 */ 38 39#ifndef lint 40static char copyright[] = 41"@(#) Copyright (c) 1991, 1993\n\ 42 The Regents of the University of California. All rights reserved.\n"; 43#endif /* not lint */ 44 --- 13 unchanged lines hidden (view full) --- 58#include <stdio.h> 59#include <stdlib.h> 60#include <string.h> 61#include <syslog.h> 62#include <time.h> 63#include <ttyent.h> 64#include <unistd.h> 65#include <sys/reboot.h> |
66#include <err.h> |
|
64 65#ifdef __STDC__ 66#include <stdarg.h> 67#else 68#include <varargs.h> 69#endif 70 71#ifdef SECURE --- 118 unchanged lines hidden (view full) --- 190 char **argv; 191{ 192 int c; 193 struct sigaction sa; 194 sigset_t mask; 195 196 197 /* Dispose of random users. */ | 67 68#ifdef __STDC__ 69#include <stdarg.h> 70#else 71#include <varargs.h> 72#endif 73 74#ifdef SECURE --- 118 unchanged lines hidden (view full) --- 193 char **argv; 194{ 195 int c; 196 struct sigaction sa; 197 sigset_t mask; 198 199 200 /* Dispose of random users. */ |
198 if (getuid() != 0) { 199 (void)fprintf(stderr, "init: %s\n", strerror(EPERM)); 200 exit (1); 201 } | 201 if (getuid() != 0) 202 errx(1, "%s", strerror(EPERM)); |
202 203 /* System V users like to reexec init. */ | 203 204 /* System V users like to reexec init. */ |
204 if (getpid() != 1) { 205 (void)fprintf(stderr, "init: already running\n"); 206 exit (1); 207 } | 205 if (getpid() != 1) 206 errx(1, "already running"); |
208 209 /* 210 * Note that this does NOT open a file... 211 * Does 'init' deserve its own facility number? 212 */ 213 openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH); 214 215 /* --- 1252 unchanged lines hidden --- | 207 208 /* 209 * Note that this does NOT open a file... 210 * Does 'init' deserve its own facility number? 211 */ 212 openlog("init", LOG_CONS|LOG_ODELAY, LOG_AUTH); 213 214 /* --- 1252 unchanged lines hidden --- |