~kaction/dvtm

c1bb5d620c2a906e632791a9052d534f04244928 — Dmitry Bogatov 7 months ago 426ff5f
vt_forkpty: check for success of chdir(2)
1 files changed, 8 insertions(+), 2 deletions(-)

M vt.c
M vt.c => vt.c +8 -2
@@ 1640,8 1640,14 @@ pid_t vt_forkpty(Vt *t, const char *p, const char *argv[], const char *cwd, cons
			setenv(envp[0], envp[1], 1);
		setenv("TERM", vt_term, 1);

		if (cwd)
			chdir(cwd);
		if (cwd) {
			int err = chdir(cwd);
			if (err) {
				fprintf(stderr, "\nchdir() failed. ");
				perror(cwd);
				exit(1);
			}
		}

		struct sigaction sa;
		memset(&sa, 0, sizeof sa);