diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-01-31 17:29:47 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-01-31 17:29:47 +0000 |
| commit | 53cfb7e23145dc192c75d207cee50be1581f8dda (patch) | |
| tree | 26efa2fd8b16f78872225a6146e01bb8eebb23d8 | |
| parent | 704d2a6c433f31da079f5b0dd3395ce0255708f9 (diff) | |
| download | busybox-w32-53cfb7e23145dc192c75d207cee50be1581f8dda.tar.gz busybox-w32-53cfb7e23145dc192c75d207cee50be1581f8dda.tar.bz2 busybox-w32-53cfb7e23145dc192c75d207cee50be1581f8dda.zip | |
Patch from Vladimir N. Oleynik to simplify/cleanup a few things in init.c
| -rw-r--r-- | init.c | 10 | ||||
| -rw-r--r-- | init/init.c | 10 |
2 files changed, 8 insertions, 12 deletions
| @@ -204,7 +204,7 @@ static void message(int device, char *fmt, ...) | |||
| 204 | va_start(arguments, fmt); | 204 | va_start(arguments, fmt); |
| 205 | vsnprintf(msg, sizeof(msg), fmt, arguments); | 205 | vsnprintf(msg, sizeof(msg), fmt, arguments); |
| 206 | va_end(arguments); | 206 | va_end(arguments); |
| 207 | openlog("init", 0, LOG_USER); | 207 | openlog(applet_name, 0, LOG_USER); |
| 208 | syslog(LOG_USER|LOG_INFO, msg); | 208 | syslog(LOG_USER|LOG_INFO, msg); |
| 209 | closelog(); | 209 | closelog(); |
| 210 | } | 210 | } |
| @@ -222,7 +222,6 @@ static void message(int device, char *fmt, ...) | |||
| 222 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { | 222 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { |
| 223 | log_fd = -2; | 223 | log_fd = -2; |
| 224 | fprintf(stderr, "Bummer, can't write to log on %s!\r\n", log); | 224 | fprintf(stderr, "Bummer, can't write to log on %s!\r\n", log); |
| 225 | fflush(stderr); | ||
| 226 | log = NULL; | 225 | log = NULL; |
| 227 | device = CONSOLE; | 226 | device = CONSOLE; |
| 228 | } | 227 | } |
| @@ -248,7 +247,6 @@ static void message(int device, char *fmt, ...) | |||
| 248 | fprintf(stderr, "Bummer, can't print: "); | 247 | fprintf(stderr, "Bummer, can't print: "); |
| 249 | va_start(arguments, fmt); | 248 | va_start(arguments, fmt); |
| 250 | vfprintf(stderr, fmt, arguments); | 249 | vfprintf(stderr, fmt, arguments); |
| 251 | fflush(stderr); | ||
| 252 | va_end(arguments); | 250 | va_end(arguments); |
| 253 | } | 251 | } |
| 254 | } | 252 | } |
| @@ -299,7 +297,7 @@ static int check_free_memory() | |||
| 299 | unsigned int result, u, s=10; | 297 | unsigned int result, u, s=10; |
| 300 | 298 | ||
| 301 | if (sysinfo(&info) != 0) { | 299 | if (sysinfo(&info) != 0) { |
| 302 | perror_msg("Error checking free memory: "); | 300 | perror_msg("Error checking free memory"); |
| 303 | return -1; | 301 | return -1; |
| 304 | } | 302 | } |
| 305 | 303 | ||
| @@ -945,7 +943,7 @@ extern int init_main(int argc, char **argv) | |||
| 945 | { | 943 | { |
| 946 | usage("init\n\nInit is the parent of all processes.\n\n" | 944 | usage("init\n\nInit is the parent of all processes.\n\n" |
| 947 | "This version of init is designed to be run only " | 945 | "This version of init is designed to be run only " |
| 948 | "by the kernel.\n"); | 946 | "by the kernel."); |
| 949 | } | 947 | } |
| 950 | /* Set up sig handlers -- be sure to | 948 | /* Set up sig handlers -- be sure to |
| 951 | * clear all of these in run() */ | 949 | * clear all of these in run() */ |
| @@ -1026,7 +1024,7 @@ extern int init_main(int argc, char **argv) | |||
| 1026 | argv[0]="init"; | 1024 | argv[0]="init"; |
| 1027 | 1025 | ||
| 1028 | if (argc > 1) | 1026 | if (argc > 1) |
| 1029 | strncpy(argv[1], "\0", strlen(argv[1])+1); | 1027 | argv[1][0]=0; |
| 1030 | 1028 | ||
| 1031 | /* Now run everything that needs to be run */ | 1029 | /* Now run everything that needs to be run */ |
| 1032 | 1030 | ||
diff --git a/init/init.c b/init/init.c index 5d0d924ad..49951b0fd 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -204,7 +204,7 @@ static void message(int device, char *fmt, ...) | |||
| 204 | va_start(arguments, fmt); | 204 | va_start(arguments, fmt); |
| 205 | vsnprintf(msg, sizeof(msg), fmt, arguments); | 205 | vsnprintf(msg, sizeof(msg), fmt, arguments); |
| 206 | va_end(arguments); | 206 | va_end(arguments); |
| 207 | openlog("init", 0, LOG_USER); | 207 | openlog(applet_name, 0, LOG_USER); |
| 208 | syslog(LOG_USER|LOG_INFO, msg); | 208 | syslog(LOG_USER|LOG_INFO, msg); |
| 209 | closelog(); | 209 | closelog(); |
| 210 | } | 210 | } |
| @@ -222,7 +222,6 @@ static void message(int device, char *fmt, ...) | |||
| 222 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { | 222 | } else if ((log_fd = device_open(log, O_RDWR|O_NDELAY)) < 0) { |
| 223 | log_fd = -2; | 223 | log_fd = -2; |
| 224 | fprintf(stderr, "Bummer, can't write to log on %s!\r\n", log); | 224 | fprintf(stderr, "Bummer, can't write to log on %s!\r\n", log); |
| 225 | fflush(stderr); | ||
| 226 | log = NULL; | 225 | log = NULL; |
| 227 | device = CONSOLE; | 226 | device = CONSOLE; |
| 228 | } | 227 | } |
| @@ -248,7 +247,6 @@ static void message(int device, char *fmt, ...) | |||
| 248 | fprintf(stderr, "Bummer, can't print: "); | 247 | fprintf(stderr, "Bummer, can't print: "); |
| 249 | va_start(arguments, fmt); | 248 | va_start(arguments, fmt); |
| 250 | vfprintf(stderr, fmt, arguments); | 249 | vfprintf(stderr, fmt, arguments); |
| 251 | fflush(stderr); | ||
| 252 | va_end(arguments); | 250 | va_end(arguments); |
| 253 | } | 251 | } |
| 254 | } | 252 | } |
| @@ -299,7 +297,7 @@ static int check_free_memory() | |||
| 299 | unsigned int result, u, s=10; | 297 | unsigned int result, u, s=10; |
| 300 | 298 | ||
| 301 | if (sysinfo(&info) != 0) { | 299 | if (sysinfo(&info) != 0) { |
| 302 | perror_msg("Error checking free memory: "); | 300 | perror_msg("Error checking free memory"); |
| 303 | return -1; | 301 | return -1; |
| 304 | } | 302 | } |
| 305 | 303 | ||
| @@ -945,7 +943,7 @@ extern int init_main(int argc, char **argv) | |||
| 945 | { | 943 | { |
| 946 | usage("init\n\nInit is the parent of all processes.\n\n" | 944 | usage("init\n\nInit is the parent of all processes.\n\n" |
| 947 | "This version of init is designed to be run only " | 945 | "This version of init is designed to be run only " |
| 948 | "by the kernel.\n"); | 946 | "by the kernel."); |
| 949 | } | 947 | } |
| 950 | /* Set up sig handlers -- be sure to | 948 | /* Set up sig handlers -- be sure to |
| 951 | * clear all of these in run() */ | 949 | * clear all of these in run() */ |
| @@ -1026,7 +1024,7 @@ extern int init_main(int argc, char **argv) | |||
| 1026 | argv[0]="init"; | 1024 | argv[0]="init"; |
| 1027 | 1025 | ||
| 1028 | if (argc > 1) | 1026 | if (argc > 1) |
| 1029 | strncpy(argv[1], "\0", strlen(argv[1])+1); | 1027 | argv[1][0]=0; |
| 1030 | 1028 | ||
| 1031 | /* Now run everything that needs to be run */ | 1029 | /* Now run everything that needs to be run */ |
| 1032 | 1030 | ||
