aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-22 17:14:10 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-22 17:14:10 +0000
commit20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df (patch)
tree0792d9bc4880082abe6eafce02d55f086ca4a500
parent4c6c23678172a4d92e1906fcda3229558eb31dd6 (diff)
downloadbusybox-w32-20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df.tar.gz
busybox-w32-20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df.tar.bz2
busybox-w32-20c9f1e5e7290c7d22bdf4217e66b9d75e9e73df.zip
Several simplifications and indenting changes, per
last_patch97 from vodz
-rw-r--r--init/init_shared.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/init/init_shared.c b/init/init_shared.c
index 81e1ea056..339add13f 100644
--- a/init/init_shared.c
+++ b/init/init_shared.c
@@ -47,52 +47,51 @@ extern int kill_init(int sig)
47} 47}
48 48
49#ifndef CONFIG_INIT 49#ifndef CONFIG_INIT
50#define LOG 0x1 50const char * const bb_shutdown_format = "\r%s\n";
51#define CONSOLE 0x2
52extern int bb_shutdown_system(unsigned long magic) 51extern int bb_shutdown_system(unsigned long magic)
53{ 52{
54 int pri = LOG_KERN|LOG_NOTICE|LOG_FACMASK; 53 int pri = LOG_KERN|LOG_NOTICE|LOG_FACMASK;
55 char *message; 54 const char *message;
56 55
57 /* Don't kill ourself */ 56 /* Don't kill ourself */
58 signal(SIGTERM,SIG_IGN); 57 signal(SIGTERM,SIG_IGN);
59 signal(SIGHUP,SIG_IGN); 58 signal(SIGHUP,SIG_IGN);
60 setpgrp(); 59 setpgrp();
61 60
62 /* Allow Ctrl-Alt-Del to reboot system. */ 61 /* Allow Ctrl-Alt-Del to reboot system. */
63#ifndef RB_ENABLE_CAD 62#ifndef RB_ENABLE_CAD
64#define RB_ENABLE_CAD 0x89abcdef 63#define RB_ENABLE_CAD 0x89abcdef
65#endif 64#endif
66 reboot(RB_ENABLE_CAD); 65 reboot(RB_ENABLE_CAD);
67 66
68 openlog("shutdown", 0, pri); 67 openlog(bb_applet_name, 0, pri);
69 68
70 message = "\n\rThe system is going down NOW !!\n"; 69 message = "\nThe system is going down NOW !!";
71 syslog(pri, "%s", message); 70 syslog(pri, "%s", message);
72 fprintf(stdout, "%s", message); 71 printf(bb_shutdown_format, message);
73 72
74 sync(); 73 sync();
75 74
76 /* Send signals to every process _except_ pid 1 */ 75 /* Send signals to every process _except_ pid 1 */
77 message = "\rSending SIGTERM to all processes.\n"; 76 message = "Sending SIGTERM to all processes.";
78 syslog(pri, "%s", message); 77 syslog(pri, "%s", message);
79 fprintf(stdout, "%s", message); 78 printf(bb_shutdown_format, message);
80 79
81 kill(-1, SIGTERM); 80 kill(-1, SIGTERM);
82 sleep(1); 81 sleep(1);
83 sync(); 82 sync();
84 83
85 message = "\rSending SIGKILL to all processes.\n"; 84 message = "Sending SIGKILL to all processes.";
86 syslog(pri, "%s", message); 85 syslog(pri, "%s", message);
87 fprintf(stdout, "%s", message); 86 printf(bb_shutdown_format, message);
88 87
89 kill(-1, SIGKILL); 88 kill(-1, SIGKILL);
90 sleep(1); 89 sleep(1);
91 90
92 sync(); 91 sync();
93 92
94 reboot(magic); 93 reboot(magic);
95 return 0; /* Shrug */ 94 return 0; /* Shrug */
96} 95}
97#endif 96#endif
98 97