summaryrefslogtreecommitdiffabout
path: root/src
Side-by-side diff
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/pies.c10
-rw-r--r--src/progman.c7
2 files changed, 12 insertions, 5 deletions
diff --git a/src/pies.c b/src/pies.c
index 2387cef..fe8d9b4 100644
--- a/src/pies.c
+++ b/src/pies.c
@@ -613,7 +613,7 @@ parse_legacy_env (char **argv, envop_t **envop)
{
msize = 2*len + 9 + vlen + 1;
mem = grecs_malloc (msize);
- snprintf (mem, msize, "${%s:-}${%s+%c}%s",
+ snprintf (mem, msize, "${%s:-}${%s:+%c}%s",
name, name, value[0], value + 1);
}
else
@@ -635,7 +635,7 @@ parse_legacy_env (char **argv, envop_t **envop)
msize = 2*len + 10 + vlen + 1;
mem = grecs_malloc (msize);
- snprintf (mem, msize, "%s${%s+%c}${%s:-}",
+ snprintf (mem, msize, "%s${%s:+%c}${%s:-}",
value, name, c, name);
}
else
@@ -785,11 +785,15 @@ _cb_env_unset (enum grecs_callback_command cmd,
void *varptr, grecs_value_t *value, void *cb_data)
{
struct component *comp = varptr;
+ char *p;
if (assert_scalar_stmt (locus, cmd)
|| assert_grecs_value_type (locus, value, GRECS_TYPE_STRING))
return 1;
- if (envop_entry_add (&comp->envop, envop_unset, value->v.string, NULL))
+ p = strchr (value->v.string, '=');
+ if (p)
+ *p++ = 0;
+ if (envop_entry_add (&comp->envop, envop_unset, value->v.string, p))
grecs_error (locus, errno, "envop_entry_add");
return 0;
}
diff --git a/src/progman.c b/src/progman.c
index b75a2db..a6dc418 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -821,7 +821,7 @@ prog_start_prologue (struct prog *prog)
{
size_t i;
for (i = 0; sockenv_var[i]; i++)
- environ_unset (prog->v.p.env, sockenv_var[i]);
+ environ_unset (prog->v.p.env, sockenv_var[i], NULL);
}
envop_exec (prog->v.p.comp->envop, prog->v.p.env);
if (init_process)
@@ -1978,10 +1978,12 @@ static void
run_command (struct action *act, struct prog *prog, unsigned retcode,
pid_t child_pid)
{
- pid_t pid;
+ pid_t pid, master_pid;
char *argv[4];
char buf[INT_BUFSIZE_BOUND (uintmax_t)];
+ master_pid = getpid ();
+
/* FIXME: optionally set output redirectors for this command? */
pid = fork ();
@@ -1998,6 +2000,7 @@ run_command (struct action *act, struct prog *prog, unsigned retcode,
setsid ();
setenv ("PIES_VERSION", PACKAGE_VERSION, 1);
setenv ("PIES_COMPONENT", prog_tag (prog), 1);
+ setenv ("PIES_MASTER_PID", umaxtostr (master_pid, buf), 1);
setenv ("PIES_PID", umaxtostr (child_pid, buf), 1);
if (retcode & STATUS_SIG_BIT)
setenv ("PIES_SIGNAL", umaxtostr (STATUS_CODE (retcode), buf), 1);

Return to:

Send suggestions and report system problems to the System administrator.