mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
slave: check return value of chdir()
This commit is contained in:
parent
01f8719c77
commit
f1b1ac39f6
1 changed files with 6 additions and 1 deletions
7
slave.c
7
slave.c
|
|
@ -103,7 +103,12 @@ slave_spawn(int ptmx, int argc, const char *cwd, char *const *argv,
|
|||
/* Child */
|
||||
close(fork_pipe[0]); /* Close read end */
|
||||
|
||||
chdir(cwd);
|
||||
if (chdir(cwd) < 0) {
|
||||
const int _errno = errno;
|
||||
LOG_ERRNO("failed to change working directory");
|
||||
(void)!write(fork_pipe[1], &_errno, sizeof(_errno));
|
||||
_exit(_errno);
|
||||
}
|
||||
|
||||
/* Restore signals */
|
||||
const struct sigaction sa = {.sa_handler = SIG_DFL};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue