~martanne/dvtm

2b5dfbf4f4bb131b947f6e238d65b6307c218124 — Dmitry Bogatov 3 years ago 2f565f2
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
@@ 1632,8 1632,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);