diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-24 22:42:29 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-24 22:42:29 +0000 |
commit | 55f30b05ac6902ac17bad04f38fd4f381a8d75f7 (patch) | |
tree | 5b98c878f1634a2ba4d1a94ea4e58919667d26c4 /networking | |
parent | c0415a983349dbd341c535991d948c2bead1ba0a (diff) | |
download | busybox-w32-55f30b05ac6902ac17bad04f38fd4f381a8d75f7.tar.gz busybox-w32-55f30b05ac6902ac17bad04f38fd4f381a8d75f7.tar.bz2 busybox-w32-55f30b05ac6902ac17bad04f38fd4f381a8d75f7.zip |
inetd,ed,msh: data/bss reduction (in mss, more than 9k of it)
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index 48e23db2e..83123463f 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -172,7 +172,6 @@ | |||
172 | #include <rpc/pmap_clnt.h> | 172 | #include <rpc/pmap_clnt.h> |
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | #define _PATH_INETDCONF "/etc/inetd.conf" | ||
176 | #define _PATH_INETDPID "/var/run/inetd.pid" | 175 | #define _PATH_INETDPID "/var/run/inetd.pid" |
177 | 176 | ||
178 | 177 | ||
@@ -327,10 +326,9 @@ static int timingout; | |||
327 | static struct servent *sp; | 326 | static struct servent *sp; |
328 | static uid_t uid; | 327 | static uid_t uid; |
329 | 328 | ||
330 | static const char *CONFIG = _PATH_INETDCONF; | 329 | static const char *config_filename = "/etc/inetd.conf"; |
331 | 330 | ||
332 | static FILE *fconfig; | 331 | static FILE *fconfig; |
333 | static char line[1024]; | ||
334 | static char *defhost; | 332 | static char *defhost; |
335 | 333 | ||
336 | /* xstrdup(NULL) returns NULL, but this one | 334 | /* xstrdup(NULL) returns NULL, but this one |
@@ -350,7 +348,7 @@ static int setconfig(void) | |||
350 | fseek(fconfig, 0L, SEEK_SET); | 348 | fseek(fconfig, 0L, SEEK_SET); |
351 | return 1; | 349 | return 1; |
352 | } | 350 | } |
353 | fconfig = fopen(CONFIG, "r"); | 351 | fconfig = fopen(config_filename, "r"); |
354 | return (fconfig != NULL); | 352 | return (fconfig != NULL); |
355 | } | 353 | } |
356 | 354 | ||
@@ -511,6 +509,8 @@ static void setup(servtab_t *sep) | |||
511 | 509 | ||
512 | static char *nextline(void) | 510 | static char *nextline(void) |
513 | { | 511 | { |
512 | #define line bb_common_bufsiz1 | ||
513 | |||
514 | char *cp; | 514 | char *cp; |
515 | FILE *fd = fconfig; | 515 | FILE *fd = fconfig; |
516 | 516 | ||
@@ -541,10 +541,12 @@ static char *skip(char **cpp) /* int report; */ | |||
541 | int c; | 541 | int c; |
542 | 542 | ||
543 | c = getc(fconfig); | 543 | c = getc(fconfig); |
544 | (void) ungetc(c, fconfig); | 544 | ungetc(c, fconfig); |
545 | if (c == ' ' || c == '\t') | 545 | if (c == ' ' || c == '\t') { |
546 | if ((cp = nextline())) | 546 | cp = nextline(); |
547 | if (cp) | ||
547 | goto again; | 548 | goto again; |
549 | } | ||
548 | *cpp = NULL; | 550 | *cpp = NULL; |
549 | /* goto erp; */ | 551 | /* goto erp; */ |
550 | return NULL; | 552 | return NULL; |
@@ -924,7 +926,7 @@ static void config(int sig ATTRIBUTE_UNUSED) | |||
924 | char protoname[10]; | 926 | char protoname[10]; |
925 | 927 | ||
926 | if (!setconfig()) { | 928 | if (!setconfig()) { |
927 | bb_perror_msg("%s", CONFIG); | 929 | bb_perror_msg("%s", config_filename); |
928 | return; | 930 | return; |
929 | } | 931 | } |
930 | for (sep = servtab; sep; sep = sep->se_next) | 932 | for (sep = servtab; sep; sep = sep->se_next) |
@@ -1281,10 +1283,10 @@ int inetd_main(int argc, char *argv[]) | |||
1281 | 1283 | ||
1282 | uid = getuid(); | 1284 | uid = getuid(); |
1283 | if (uid != 0) | 1285 | if (uid != 0) |
1284 | CONFIG = NULL; | 1286 | config_filename = NULL; |
1285 | if (argc > 0) | 1287 | if (argc > 0) |
1286 | CONFIG = argv[0]; | 1288 | config_filename = argv[0]; |
1287 | if (CONFIG == NULL) | 1289 | if (config_filename == NULL) |
1288 | bb_error_msg_and_die("non-root must specify a config file"); | 1290 | bb_error_msg_and_die("non-root must specify a config file"); |
1289 | 1291 | ||
1290 | #ifdef BB_NOMMU | 1292 | #ifdef BB_NOMMU |