diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-12-30 15:36:56 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-01-04 12:29:27 +0200 |
commit | cf14c349fad774e477a80d1c5e6572f21f17ced1 (patch) | |
tree | d8d73b072902cadc5aea5583119ec9e4e8ced2bc /src/inetd.c | |
parent | 64c343ff8f11c8379ec21916ba915a2894495797 (diff) | |
download | pies-cf14c349fad774e477a80d1c5e6572f21f17ced1.tar.gz pies-cf14c349fad774e477a80d1c5e6572f21f17ced1.tar.bz2 |
Initial support for running as init process.
* grecs: Upgrade.
* lib/Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
* src/Makefile.am: Likewise.
* src/acl.c: Update grecs_keyword definitions.
* src/inetd.c (inetd_conf_file): Bugfix. The ws structure could
be free'd prior to initialization.
* src/pies.c: Update grecs_keyword definitions.
(init_process,initdefault,dfl_level): New globals.
(modetab) <once>: New keyword.
(component_keywords)<runlevels,initdefault>: New keywords.
(main): Initial support for init(8) mode.
* src/pies.h (pies_comp_mode) <pies_comp_exec_once>: New constant.
(component)<runlevels>: New member.
(init_process,console_device,initdefault): New externs.
* src/progman.c (prog_status)<status_finished>: New status.
(prog)<runlevels>: New member.
(progman_running_p): New function.
(prog_start): Special handling for init process mode.
(progman_start): Likewise. Take into account runlevels.
(progman_dump_stats): New flag 'f' for status_finished.
Diffstat (limited to 'src/inetd.c')
-rw-r--r-- | src/inetd.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/inetd.c b/src/inetd.c index 1d7798d..febd84e 100644 --- a/src/inetd.c +++ b/src/inetd.c @@ -84,6 +84,7 @@ inetd_conf_file (const char *file) size_t line_no = 0; struct wordsplit ws; char *dfl_address = NULL; + int wsflags; fp = fopen (file, "r"); if (!fp) @@ -94,6 +95,7 @@ inetd_conf_file (const char *file) return 1; } + wsflags = WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_WS | WRDSF_SQUEEZE_DELIMS; while (getline (&buf, &size, fp) >= 0) { char *p; @@ -111,9 +113,6 @@ inetd_conf_file (const char *file) struct inetd_builtin *builtin; char *tag; - if (line_no) - wordsplit_free (&ws); - line_no++; for (p = buf; *p && c_isblank (*p); p++) ; @@ -121,14 +120,12 @@ inetd_conf_file (const char *file) if (!p || *p == '\n' || *p == '#') continue; - if (wordsplit (p, &ws, - WRDSF_NOVAR | WRDSF_NOCMD | WRDSF_WS | - WRDSF_SQUEEZE_DELIMS)) + if (wordsplit (p, &ws, wsflags)) { logmsg (LOG_ERR, "wordsplit: %s", strerror (errno)); continue; } - + wsflags |= WRDSF_REUSE; if (ws.ws_wordc == 1) { size_t len = strlen (ws.ws_wordv[IFLD_SERVICE]); @@ -308,7 +305,7 @@ inetd_conf_file (const char *file) register_prog (comp); } - if (line_no) + if (wsflags & WRDSF_REUSE) wordsplit_free (&ws); free (dfl_address); free (buf); |