mirror of
https://github.com/tmux/tmux.git
synced 2025-12-18 00:02:54 -05:00
Don't try to change directory if it is NULL.
This commit is contained in:
parent
c62fe6dac8
commit
b21b1ee9af
2
job.c
2
job.c
@ -141,6 +141,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e,
|
|||||||
proc_clear_signals(server_proc, 1);
|
proc_clear_signals(server_proc, 1);
|
||||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||||
|
|
||||||
|
if (cwd != NULL) {
|
||||||
if (chdir(cwd) == 0)
|
if (chdir(cwd) == 0)
|
||||||
environ_set(env, "PWD", 0, "%s", cwd);
|
environ_set(env, "PWD", 0, "%s", cwd);
|
||||||
else if ((home = find_home()) != NULL && chdir(home) == 0)
|
else if ((home = find_home()) != NULL && chdir(home) == 0)
|
||||||
@ -149,6 +150,7 @@ job_run(const char *cmd, int argc, char **argv, struct environ *e,
|
|||||||
environ_set(env, "PWD", 0, "/");
|
environ_set(env, "PWD", 0, "/");
|
||||||
else
|
else
|
||||||
fatal("chdir failed");
|
fatal("chdir failed");
|
||||||
|
}
|
||||||
|
|
||||||
environ_push(env);
|
environ_push(env);
|
||||||
environ_free(env);
|
environ_free(env);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user