summaryrefslogtreecommitdiff
path: root/master.c
diff options
context:
space:
mode:
Diffstat (limited to 'master.c')
-rw-r--r--master.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/master.c b/master.c
index 3755f65..81aa6a9 100644
--- a/master.c
+++ b/master.c
@@ -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);