From 759efe1b3327a7244c03ecc7b90e0e3c49712d06 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 11 Oct 2021 10:55:30 +0000 Subject: Add -e flag to set environment for popup, from Alexis Hildebrandt in GitHub issue 2924. --- job.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'job.c') diff --git a/job.c b/job.c index 66a25557..4c13f943 100644 --- a/job.c +++ b/job.c @@ -71,7 +71,7 @@ static LIST_HEAD(joblist, job) all_jobs = LIST_HEAD_INITIALIZER(all_jobs); /* Start a job running. */ struct job * -job_run(const char *cmd, int argc, char **argv, struct session *s, +job_run(const char *cmd, int argc, char **argv, struct environ *e, struct session *s, const char *cwd, job_update_cb updatecb, job_complete_cb completecb, job_free_cb freecb, void *data, int flags, int sx, int sy) { @@ -89,6 +89,9 @@ job_run(const char *cmd, int argc, char **argv, struct session *s, * if-shell to decide on default-terminal based on outside TERM. */ env = environ_for_session(s, !cfg_finished); + if (e != NULL) { + environ_copy(e, env); + } sigfillset(&set); sigprocmask(SIG_BLOCK, &set, &oldset); -- cgit From 9b4148b12ca631b9cb8f48a03adb1fad146ee53d Mon Sep 17 00:00:00 2001 From: deraadt Date: Sun, 24 Oct 2021 21:24:17 +0000 Subject: For open/openat, if the flags parameter does not contain O_CREAT, the 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert --- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'job.c') diff --git a/job.c b/job.c index 4c13f943..dad211f4 100644 --- a/job.c +++ b/job.c @@ -142,7 +142,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e, struct sessio close(out[1]); close(out[0]); - nullfd = open(_PATH_DEVNULL, O_RDWR, 0); + nullfd = open(_PATH_DEVNULL, O_RDWR); if (nullfd == -1) fatal("open failed"); if (dup2(nullfd, STDERR_FILENO) == -1) -- cgit From 7a4ba6d4a5458f4e2450024d72f0e16905dd5c64 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 1 Feb 2022 12:05:42 +0000 Subject: Mention that if-shell and #() use /bin/sh. --- job.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'job.c') diff --git a/job.c b/job.c index dad211f4..fb33c0cf 100644 --- a/job.c +++ b/job.c @@ -89,9 +89,8 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e, struct sessio * if-shell to decide on default-terminal based on outside TERM. */ env = environ_for_session(s, !cfg_finished); - if (e != NULL) { + if (e != NULL) environ_copy(e, env); - } sigfillset(&set); sigprocmask(SIG_BLOCK, &set, &oldset); -- cgit