diff options
| author | Ned T. Crigler <crigler@gmail.com> | 2025-06-19 11:22:55 -0700 |
|---|---|---|
| committer | Ned T. Crigler <crigler@gmail.com> | 2025-06-19 20:11:34 -0700 |
| commit | 6e04acf9ed089f065b19ff4e42be97bd17529ff2 (patch) | |
| tree | fde130059bbc9e2ba0675ee50f819fa3a36c669c /master.c | |
| parent | 5e3865328e4609f74bd10cb4575e429b8d1b3aa4 (diff) | |
Check the return value of the fchdir() system call
dtach was not checking if the fchdir back to the old directory worked
when it tried to get around the sun_path length limit.
Diffstat (limited to 'master.c')
| -rw-r--r-- | master.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -594,7 +594,11 @@ master_main(char **argv, int waitattach, int dontfork) if (chdir(sockname) >= 0) { s = create_socket(slash + 1); - fchdir(dirfd); + if (s >= 0 && fchdir(dirfd) < 0) + { + close(s); + s = -1; + } } *slash = '/'; close(dirfd); |
