diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-12-05 16:58:05 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-12-05 20:03:46 +0200 |
commit | b3a58380b93512b86fe02749425410d89a5655d4 (patch) | |
tree | 5a4d63cdb876b35a23f18256c9d82aaa6f32a983 /src | |
parent | 7d9e36f5b5ce1175afcb1f65184b8b2029a2d6a8 (diff) | |
download | pies-b3a58380b93512b86fe02749425410d89a5655d4.tar.gz pies-b3a58380b93512b86fe02749425410d89a5655d4.tar.bz2 |
Remove the component.facility keyword. Update the docs.
* NEWS: Update.
* doc/pies.texi: Update.
* src/pies.h (component): Remove the facility field.
* src/comp.c: Likewise.
* configure.ac: Select interface to use to close fds (imported from
mailutils).
* lib/closefds.c: New file (imported from mailutils).
* lib/Makefile.am: Add closefds.c
* lib/libpies.h (pies_close_fds): New proto.
* src/pies.c: Use pies_close_fds
* src/progman.c: Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/comp.c | 2 | ||||
-rw-r--r-- | src/pies.c | 15 | ||||
-rw-r--r-- | src/pies.h | 1 | ||||
-rw-r--r-- | src/progman.c | 25 |
4 files changed, 4 insertions, 39 deletions
@@ -154,7 +154,6 @@ component_create (const char *name) { comp = grecs_zalloc (sizeof (*comp)); comp->listidx = cur; - comp->facility = pies_log_facility; comp->redir[RETR_OUT].type = comp->redir[RETR_ERR].type = redir_null; comp->tag = grecs_strdup (name); comp->socket_type = SOCK_STREAM; @@ -293,7 +292,6 @@ component_match (struct component *comp, struct component *ref) EQ (pass_fd_timeout); FN (acl, pies_acl_cmp); FN (tcpmux, safe_strcmp); - EQ (facility); FNP (redir[0], redirector_cmp); FNP (redir[1], redirector_cmp); #undef MATCH @@ -1367,13 +1367,6 @@ struct grecs_keyword component_keywords[] = { NULL, offsetof (struct component, rmfile), NULL, }, - {"facility", - N_("arg"), - N_("Override default syslog facility for this component."), - grecs_type_string, GRECS_DFLT, - NULL, offsetof (struct component, facility), - cb_syslog_facility, - }, {"stdout", /* TRANSLATORS: file and syslog are keywords. Do not translate them. */ N_("type: {file | syslog}> <channel: string"), @@ -2634,14 +2627,8 @@ main (int argc, char **argv) if (action == ACTION_RESTART) { - int minfd = DIAG_OUTPUT (DIAG_TO_STDERR) ? 2 : 0; - int i; - - for (i = getmaxfd (); i > minfd; i--) - close (i); - + pies_close_fds (2); signal_setup (SIG_DFL); - execv (pies_master_argv[0], pies_master_argv); } @@ -270,7 +270,6 @@ struct component char *max_ip_connections_message; /* Redirectors: */ - int facility; /* Syslog facility. */ struct redirector redir[2]; /* Repeaters for stdout and stderr */ /* Actions to execute on various exit codes: */ struct grecs_list *act_list; diff --git a/src/progman.c b/src/progman.c index 81accfb..d808010 100644 --- a/src/progman.c +++ b/src/progman.c @@ -434,19 +434,6 @@ redirect_to_syslog (struct prog *master, int stream, int *fd) return p[1]; } -static void -close_fds (fd_set *fdset) -{ - int i; - - for (i = FD_SETSIZE-1; i >= 0; i--) - { - if (fdset && FD_ISSET (i, fdset)) - continue; - close (i); - } -} - void free_redirector (struct redirector *rp) { @@ -939,7 +926,6 @@ prog_start (struct prog *prog) { pid_t pid; int redir[2]; - fd_set fdset; if (prog->pid > 0 || !IS_COMPONENT (prog)) return; @@ -1106,13 +1092,8 @@ prog_start (struct prog *prog) } /* Close unneeded descripitors */ - FD_ZERO (&fdset); - FD_SET (0, &fdset); - FD_SET (1, &fdset); - FD_SET (2, &fdset); - if (prog->v.p.comp->mode == pies_comp_pass_fd) - FD_SET (prog->v.p.socket, &fdset); - close_fds (&fdset); + pies_close_fds (prog->v.p.comp->mode == pies_comp_pass_fd + ? prog->v.p.socket : 2); prog_execute (prog); @@ -2047,7 +2028,7 @@ run_command (struct action *act, struct prog *prog, unsigned retcode, else setenv ("PIES_STATUS", umaxtostr (STATUS_CODE (retcode), buf), 1); - close_fds (NULL); + pies_close_fds (2); argv[0] = "/bin/sh"; argv[1] = "-c"; |