From 973e129f6ef4759609d45208003a0f50536984b4 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 21 Aug 2022 11:39:26 +0100 Subject: [PATCH 1/1] prefork-interp: formalise mediation etc. Signed-off-by: Ian Jackson --- cprogs/prefork-interp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index 918083e..fb1be68 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -268,21 +268,24 @@ void fusagemessage(FILE *f) { fprintf(f, "usage: #!/usr/bin/prefork-interp []\n"); } -static int laundering; -static int mode; -static int max_sockets = 100; // maximum entries in the run dir is 2x this - -static struct stat initial_stab; - #define MODE_NORMAL 0 #define MODE_KILL 'k' #define MODE_FRESH 'f' +#define MEDIATION_UNSPECIFIED 0 +#define MEDIATION_UNLAUNDERED 'U' + +static int mediation = MEDIATION_UNSPECIFIED; +static int mode = MODE_NORMAL; +static int max_sockets = 100; // maximum entries in the run dir is 2x this + +static struct stat initial_stab; + const struct cmdinfo cmdinfos[]= { PREFORK_CMDINFOS - { 0, 'U', 0, .iassignto= &laundering, .arg= 'U' }, - { "kill", 0, 0, .iassignto= &mode, .arg= MODE_KILL }, - { 0, 'f', 0, .iassignto= &mode, .arg= MODE_FRESH }, + { 0, 'U', 0, .iassignto= &mediation, .arg= MEDIATION_UNLAUNDERED }, + { "kill", 0, 0, .iassignto= &mode, .arg= MODE_KILL }, + { 0, 'f', 0, .iassignto= &mode, .arg= MODE_FRESH }, { 0 } }; @@ -834,8 +837,8 @@ static void connect_or_spawn(void) { } static void make_executor_argv(const char *const *argv) { - switch (laundering) { - case 'U': break; + switch (mediation) { + case MEDIATION_UNLAUNDERED: break; default: die("need -U (specifying unlaundered argument handling)"); } -- 2.30.2