aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-04-18 23:51:51 +0000
committerErik Andersen <andersen@codepoet.org>2000-04-18 23:51:51 +0000
commitf13df3752cd5077622201e6b69c71cd7cd5095a4 (patch)
tree7906a531af36ee77b6ca02eefa92ff97ecfd6704
parent9a8195cc03516b9f376b0f965d9f05fa326ac5d2 (diff)
downloadbusybox-w32-f13df3752cd5077622201e6b69c71cd7cd5095a4.tar.gz
busybox-w32-f13df3752cd5077622201e6b69c71cd7cd5095a4.tar.bz2
busybox-w32-f13df3752cd5077622201e6b69c71cd7cd5095a4.zip
More stuff
-Erik
-rw-r--r--sysklogd/syslogd.c149
-rw-r--r--syslogd.c149
2 files changed, 144 insertions, 154 deletions
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index 228d0a17a..4cfb458ed 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -5,6 +5,8 @@
5 * Copyright (C) 1999,2000 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
@@ -74,39 +76,38 @@ static const char syslogd_usage[] =
74 76
75/* Note: There is also a function called "message()" in init.c */ 77/* Note: There is also a function called "message()" in init.c */
76/* Print a message to the log file. */ 78/* Print a message to the log file. */
77static void message(char *fmt, ...) 79static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
78 __attribute__ ((format (printf, 1, 2))); 80static void message (char *fmt, ...)
79static void message(char *fmt, ...)
80{ 81{
81 int fd; 82 int fd;
82 va_list arguments; 83 va_list arguments;
83 84
84 if ( (fd = device_open(logFilePath, 85 if ((fd = device_open (logFilePath,
85 O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND | 86 O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND |
86 O_NONBLOCK)) >= 0) { 87 O_NONBLOCK)) >= 0) {
87 va_start(arguments, fmt); 88 va_start (arguments, fmt);
88 vdprintf(fd, fmt, arguments); 89 vdprintf (fd, fmt, arguments);
89 va_end(arguments); 90 va_end (arguments);
90 close(fd); 91 close (fd);
91 } else { 92 } else {
92 /* Always send console messages to /dev/console so people will see them. */ 93 /* Always send console messages to /dev/console so people will see them. */
93 if ( (fd = device_open(_PATH_CONSOLE, 94 if ((fd = device_open (_PATH_CONSOLE,
94 O_WRONLY | O_NOCTTY | O_NONBLOCK)) >= 0) { 95 O_WRONLY | O_NOCTTY | O_NONBLOCK)) >= 0) {
95 va_start(arguments, fmt); 96 va_start (arguments, fmt);
96 vdprintf(fd, fmt, arguments); 97 vdprintf (fd, fmt, arguments);
97 va_end(arguments); 98 va_end (arguments);
98 close(fd); 99 close (fd);
99 } else { 100 } else {
100 fprintf(stderr, "Bummer, can't print: "); 101 fprintf (stderr, "Bummer, can't print: ");
101 va_start(arguments, fmt); 102 va_start (arguments, fmt);
102 vfprintf(stderr, fmt, arguments); 103 vfprintf (stderr, fmt, arguments);
103 fflush(stderr); 104 fflush (stderr);
104 va_end(arguments); 105 va_end (arguments);
105 } 106 }
106 } 107 }
107} 108}
108 109
109static void logMessage(int pri, char *msg) 110static void logMessage (int pri, char *msg)
110{ 111{
111 time_t now; 112 time_t now;
112 char *timestamp; 113 char *timestamp;
@@ -161,11 +162,13 @@ static void doSyslogd (void)
161{ 162{
162 struct sockaddr_un sunx; 163 struct sockaddr_un sunx;
163 size_t addrLength; 164 size_t addrLength;
165
164 int sock_fd; 166 int sock_fd;
165 fd_set readfds; 167 fd_set fds;
168
166 char lfile[PATH_MAX]; 169 char lfile[PATH_MAX];
167 170
168 /* Set up sig handlers */ 171 /* Set up signal handlers. */
169 signal (SIGINT, quit_signal); 172 signal (SIGINT, quit_signal);
170 signal (SIGTERM, quit_signal); 173 signal (SIGTERM, quit_signal);
171 signal (SIGQUIT, quit_signal); 174 signal (SIGQUIT, quit_signal);
@@ -173,86 +176,81 @@ static void doSyslogd (void)
173 signal (SIGALRM, domark); 176 signal (SIGALRM, domark);
174 alarm (MarkInterval); 177 alarm (MarkInterval);
175 178
176 /* create the syslog file so realpath() can work */ 179 /* Create the syslog file so realpath() can work. */
177 close(open(_PATH_LOG, O_RDWR | O_CREAT, 0644)); 180 close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
178 if (realpath(_PATH_LOG, lfile) == NULL) { 181 if (realpath (_PATH_LOG, lfile) == NULL)
179 fatalError("Could not resolv path to " _PATH_LOG); 182 fatalError ("Could not resolv path to " _PATH_LOG ": %s", strerror (errno));
180 }
181 183
182 unlink (lfile); 184 unlink (lfile);
183 185
184 memset (&sunx, 0, sizeof(sunx)); 186 memset (&sunx, 0, sizeof (sunx));
185
186 sunx.sun_family = AF_UNIX; 187 sunx.sun_family = AF_UNIX;
187 strncpy (sunx.sun_path, lfile, sizeof(sunx.sun_path)); 188 strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
188 if ((sock_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { 189 if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
189 fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG); 190 fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s", strerror (errno));
190 }
191 191
192 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); 192 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
193 if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || 193 if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
194 (listen (sock_fd, 5))) { 194 fatalError ("Could not connect to socket " _PATH_LOG ": %s", strerror (errno));
195 fatalError ("Could not connect to socket " _PATH_LOG);
196 }
197 195
198 if (chmod (lfile, 0666) < 0) { 196 if (chmod (lfile, 0666) < 0)
199 fatalError ("Could not set permission on " _PATH_LOG); 197 fatalError ("Could not set permission on " _PATH_LOG ": %s", strerror (errno));
200 }
201 198
202 FD_ZERO (&readfds); 199 FD_ZERO (&fds);
203 FD_SET (sock_fd, &readfds); 200 FD_SET (sock_fd, &fds);
204 201
205 logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); 202 logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")");
206 203
207 for (;;) { 204 for (;;) {
208 int n_ready; 205
209 int fd; 206 fd_set readfds;
207 int n_ready;
208 int fd;
209
210 memcpy (&readfds, &fds, sizeof (fds));
210 211
211 if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { 212 if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
212 if (errno == EINTR) continue; /* alarm may have happened. */ 213 if (errno == EINTR) continue; /* alarm may have happened. */
213 fatalError( "select error: %s\n", strerror(errno)); 214 fatalError ("select error: %s\n", strerror (errno));
214 } 215 }
215 216
216 /* Skip stdin, stdout, stderr */ 217 for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
217 for (fd = 3; fd < FD_SETSIZE; fd++) {
218 if (FD_ISSET (fd, &readfds)) { 218 if (FD_ISSET (fd, &readfds)) {
219 --n_ready;
219 if (fd == sock_fd) { 220 if (fd == sock_fd) {
220 int conn; 221 int conn;
221 if ((conn = accept(sock_fd, (struct sockaddr *) &sunx, 222 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
222 &addrLength)) < 0) { 223 fatalError ("accept error: %s\n", strerror (errno));
223 fatalError( "accept error: %s\n", strerror(errno));
224 } 224 }
225 FD_SET (conn, &readfds); 225 FD_SET (conn, &fds);
226 continue;
226 } 227 }
227 else { 228 else {
228#define BUFSIZE 1024 + 1 229# define BUFSIZE 1023
229 char buf; 230 char buf[ BUFSIZE + 1 ];
230 char *q, *p;
231 int n_read; 231 int n_read;
232 char line[BUFSIZE]; 232
233 unsigned char c; 233 while ((n_read = read (fd, buf, BUFSIZE )) > 0) {
234 int pri; 234
235 235 int pri = (LOG_USER | LOG_NOTICE);
236 /* Get set to read in a line */ 236 char line[ BUFSIZE + 1 ];
237 memset (line, 0, sizeof(line)); 237 unsigned char c;
238 pri = (LOG_USER | LOG_NOTICE); 238 char *p = buf, *q = line;
239 239
240 /* Keep reading stuff till there is nothing else to read */ 240 buf[ n_read - 1 ] = '\0';
241 while( (n_read = read (fd, &buf, 1)) > 0) { 241
242 p = &buf; 242 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
243 q = line;
244 while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
245 if (c == '<') { 243 if (c == '<') {
246 /* Parse the magic priority number */ 244 /* Parse the magic priority number. */
247 pri = 0; 245 pri = 0;
248 while (isdigit(*(++p))) { 246 while (isdigit (*(++p))) {
249 pri = 10 * pri + (*p - '0'); 247 pri = 10 * pri + (*p - '0');
250 } 248 }
251 if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) 249 if (pri & ~(LOG_FACMASK | LOG_PRIMASK))
252 pri = (LOG_USER | LOG_NOTICE); 250 pri = (LOG_USER | LOG_NOTICE);
253 } else if (c == '\n') { 251 } else if (c == '\n') {
254 *q++ = ' '; 252 *q++ = ' ';
255 } else if (iscntrl(c) && (c < 0177)) { 253 } else if (iscntrl (c) && (c < 0177)) {
256 *q++ = '^'; 254 *q++ = '^';
257 *q++ = c ^ 0100; 255 *q++ = c ^ 0100;
258 } else { 256 } else {
@@ -261,13 +259,11 @@ static void doSyslogd (void)
261 p++; 259 p++;
262 } 260 }
263 *q = '\0'; 261 *q = '\0';
264
265 /* Now log it */ 262 /* Now log it */
266 logMessage(pri, line); 263 logMessage (pri, line);
267 break;
268 } 264 }
269 close (fd); 265 close (fd);
270 FD_CLR (fd, &readfds); 266 FD_CLR (fd, &fds);
271 } 267 }
272 } 268 }
273 } 269 }
@@ -351,7 +347,6 @@ static void doKlogd (void)
351 347
352#endif 348#endif
353 349
354static void daemon_init (char **argv, char *dz, void fn (void)) __attribute__ ((noreturn));
355static void daemon_init (char **argv, char *dz, void fn (void)) 350static void daemon_init (char **argv, char *dz, void fn (void))
356{ 351{
357 setsid(); 352 setsid();
diff --git a/syslogd.c b/syslogd.c
index 228d0a17a..4cfb458ed 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -5,6 +5,8 @@
5 * Copyright (C) 1999,2000 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc.
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
7 * 7 *
8 * Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
@@ -74,39 +76,38 @@ static const char syslogd_usage[] =
74 76
75/* Note: There is also a function called "message()" in init.c */ 77/* Note: There is also a function called "message()" in init.c */
76/* Print a message to the log file. */ 78/* Print a message to the log file. */
77static void message(char *fmt, ...) 79static void message (char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
78 __attribute__ ((format (printf, 1, 2))); 80static void message (char *fmt, ...)
79static void message(char *fmt, ...)
80{ 81{
81 int fd; 82 int fd;
82 va_list arguments; 83 va_list arguments;
83 84
84 if ( (fd = device_open(logFilePath, 85 if ((fd = device_open (logFilePath,
85 O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND | 86 O_WRONLY | O_CREAT | O_NOCTTY | O_APPEND |
86 O_NONBLOCK)) >= 0) { 87 O_NONBLOCK)) >= 0) {
87 va_start(arguments, fmt); 88 va_start (arguments, fmt);
88 vdprintf(fd, fmt, arguments); 89 vdprintf (fd, fmt, arguments);
89 va_end(arguments); 90 va_end (arguments);
90 close(fd); 91 close (fd);
91 } else { 92 } else {
92 /* Always send console messages to /dev/console so people will see them. */ 93 /* Always send console messages to /dev/console so people will see them. */
93 if ( (fd = device_open(_PATH_CONSOLE, 94 if ((fd = device_open (_PATH_CONSOLE,
94 O_WRONLY | O_NOCTTY | O_NONBLOCK)) >= 0) { 95 O_WRONLY | O_NOCTTY | O_NONBLOCK)) >= 0) {
95 va_start(arguments, fmt); 96 va_start (arguments, fmt);
96 vdprintf(fd, fmt, arguments); 97 vdprintf (fd, fmt, arguments);
97 va_end(arguments); 98 va_end (arguments);
98 close(fd); 99 close (fd);
99 } else { 100 } else {
100 fprintf(stderr, "Bummer, can't print: "); 101 fprintf (stderr, "Bummer, can't print: ");
101 va_start(arguments, fmt); 102 va_start (arguments, fmt);
102 vfprintf(stderr, fmt, arguments); 103 vfprintf (stderr, fmt, arguments);
103 fflush(stderr); 104 fflush (stderr);
104 va_end(arguments); 105 va_end (arguments);
105 } 106 }
106 } 107 }
107} 108}
108 109
109static void logMessage(int pri, char *msg) 110static void logMessage (int pri, char *msg)
110{ 111{
111 time_t now; 112 time_t now;
112 char *timestamp; 113 char *timestamp;
@@ -161,11 +162,13 @@ static void doSyslogd (void)
161{ 162{
162 struct sockaddr_un sunx; 163 struct sockaddr_un sunx;
163 size_t addrLength; 164 size_t addrLength;
165
164 int sock_fd; 166 int sock_fd;
165 fd_set readfds; 167 fd_set fds;
168
166 char lfile[PATH_MAX]; 169 char lfile[PATH_MAX];
167 170
168 /* Set up sig handlers */ 171 /* Set up signal handlers. */
169 signal (SIGINT, quit_signal); 172 signal (SIGINT, quit_signal);
170 signal (SIGTERM, quit_signal); 173 signal (SIGTERM, quit_signal);
171 signal (SIGQUIT, quit_signal); 174 signal (SIGQUIT, quit_signal);
@@ -173,86 +176,81 @@ static void doSyslogd (void)
173 signal (SIGALRM, domark); 176 signal (SIGALRM, domark);
174 alarm (MarkInterval); 177 alarm (MarkInterval);
175 178
176 /* create the syslog file so realpath() can work */ 179 /* Create the syslog file so realpath() can work. */
177 close(open(_PATH_LOG, O_RDWR | O_CREAT, 0644)); 180 close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
178 if (realpath(_PATH_LOG, lfile) == NULL) { 181 if (realpath (_PATH_LOG, lfile) == NULL)
179 fatalError("Could not resolv path to " _PATH_LOG); 182 fatalError ("Could not resolv path to " _PATH_LOG ": %s", strerror (errno));
180 }
181 183
182 unlink (lfile); 184 unlink (lfile);
183 185
184 memset (&sunx, 0, sizeof(sunx)); 186 memset (&sunx, 0, sizeof (sunx));
185
186 sunx.sun_family = AF_UNIX; 187 sunx.sun_family = AF_UNIX;
187 strncpy (sunx.sun_path, lfile, sizeof(sunx.sun_path)); 188 strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
188 if ((sock_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { 189 if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
189 fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG); 190 fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s", strerror (errno));
190 }
191 191
192 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); 192 addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
193 if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || 193 if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
194 (listen (sock_fd, 5))) { 194 fatalError ("Could not connect to socket " _PATH_LOG ": %s", strerror (errno));
195 fatalError ("Could not connect to socket " _PATH_LOG);
196 }
197 195
198 if (chmod (lfile, 0666) < 0) { 196 if (chmod (lfile, 0666) < 0)
199 fatalError ("Could not set permission on " _PATH_LOG); 197 fatalError ("Could not set permission on " _PATH_LOG ": %s", strerror (errno));
200 }
201 198
202 FD_ZERO (&readfds); 199 FD_ZERO (&fds);
203 FD_SET (sock_fd, &readfds); 200 FD_SET (sock_fd, &fds);
204 201
205 logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")"); 202 logMessage (0, "syslogd started: BusyBox v" BB_VER " (" BB_BT ")");
206 203
207 for (;;) { 204 for (;;) {
208 int n_ready; 205
209 int fd; 206 fd_set readfds;
207 int n_ready;
208 int fd;
209
210 memcpy (&readfds, &fds, sizeof (fds));
210 211
211 if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { 212 if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
212 if (errno == EINTR) continue; /* alarm may have happened. */ 213 if (errno == EINTR) continue; /* alarm may have happened. */
213 fatalError( "select error: %s\n", strerror(errno)); 214 fatalError ("select error: %s\n", strerror (errno));
214 } 215 }
215 216
216 /* Skip stdin, stdout, stderr */ 217 for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
217 for (fd = 3; fd < FD_SETSIZE; fd++) {
218 if (FD_ISSET (fd, &readfds)) { 218 if (FD_ISSET (fd, &readfds)) {
219 --n_ready;
219 if (fd == sock_fd) { 220 if (fd == sock_fd) {
220 int conn; 221 int conn;
221 if ((conn = accept(sock_fd, (struct sockaddr *) &sunx, 222 if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
222 &addrLength)) < 0) { 223 fatalError ("accept error: %s\n", strerror (errno));
223 fatalError( "accept error: %s\n", strerror(errno));
224 } 224 }
225 FD_SET (conn, &readfds); 225 FD_SET (conn, &fds);
226 continue;
226 } 227 }
227 else { 228 else {
228#define BUFSIZE 1024 + 1 229# define BUFSIZE 1023
229 char buf; 230 char buf[ BUFSIZE + 1 ];
230 char *q, *p;
231 int n_read; 231 int n_read;
232 char line[BUFSIZE]; 232
233 unsigned char c; 233 while ((n_read = read (fd, buf, BUFSIZE )) > 0) {
234 int pri; 234
235 235 int pri = (LOG_USER | LOG_NOTICE);
236 /* Get set to read in a line */ 236 char line[ BUFSIZE + 1 ];
237 memset (line, 0, sizeof(line)); 237 unsigned char c;
238 pri = (LOG_USER | LOG_NOTICE); 238 char *p = buf, *q = line;
239 239
240 /* Keep reading stuff till there is nothing else to read */ 240 buf[ n_read - 1 ] = '\0';
241 while( (n_read = read (fd, &buf, 1)) > 0) { 241
242 p = &buf; 242 while (p && (c = *p) && q < &line[ sizeof (line) - 1 ]) {
243 q = line;
244 while (p && (c = *p) && q < &line[sizeof(line) - 1]) {
245 if (c == '<') { 243 if (c == '<') {
246 /* Parse the magic priority number */ 244 /* Parse the magic priority number. */
247 pri = 0; 245 pri = 0;
248 while (isdigit(*(++p))) { 246 while (isdigit (*(++p))) {
249 pri = 10 * pri + (*p - '0'); 247 pri = 10 * pri + (*p - '0');
250 } 248 }
251 if (pri & ~(LOG_FACMASK | LOG_PRIMASK)) 249 if (pri & ~(LOG_FACMASK | LOG_PRIMASK))
252 pri = (LOG_USER | LOG_NOTICE); 250 pri = (LOG_USER | LOG_NOTICE);
253 } else if (c == '\n') { 251 } else if (c == '\n') {
254 *q++ = ' '; 252 *q++ = ' ';
255 } else if (iscntrl(c) && (c < 0177)) { 253 } else if (iscntrl (c) && (c < 0177)) {
256 *q++ = '^'; 254 *q++ = '^';
257 *q++ = c ^ 0100; 255 *q++ = c ^ 0100;
258 } else { 256 } else {
@@ -261,13 +259,11 @@ static void doSyslogd (void)
261 p++; 259 p++;
262 } 260 }
263 *q = '\0'; 261 *q = '\0';
264
265 /* Now log it */ 262 /* Now log it */
266 logMessage(pri, line); 263 logMessage (pri, line);
267 break;
268 } 264 }
269 close (fd); 265 close (fd);
270 FD_CLR (fd, &readfds); 266 FD_CLR (fd, &fds);
271 } 267 }
272 } 268 }
273 } 269 }
@@ -351,7 +347,6 @@ static void doKlogd (void)
351 347
352#endif 348#endif
353 349
354static void daemon_init (char **argv, char *dz, void fn (void)) __attribute__ ((noreturn));
355static void daemon_init (char **argv, char *dz, void fn (void)) 350static void daemon_init (char **argv, char *dz, void fn (void))
356{ 351{
357 setsid(); 352 setsid();