Skip to content

Commit 6e61449

Browse files
jgriffithsgitster
authored andcommitted
credential-cache--daemon: change to the socket dir on startup
Changing to the socket path stops the daemon holding open the directory the user was in when it was started, preventing umount from working. We're already holding open a socket in that directory, so there's no downside. Thanks-to: Jeff King <[email protected]> Signed-off-by: Jon Griffiths <[email protected]> Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bd93b8d commit 6e61449

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

credential-cache--daemon.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,15 @@ static void init_socket_directory(const char *path)
236236
if (mkdir(dir, 0700) < 0)
237237
die_errno("unable to mkdir '%s'", dir);
238238
}
239+
240+
if (chdir(dir))
241+
/*
242+
* We don't actually care what our cwd is; we chdir here just to
243+
* be a friendly daemon and avoid tying up our original cwd.
244+
* If this fails, it's OK to just continue without that benefit.
245+
*/
246+
;
247+
239248
free(path_copy);
240249
}
241250

0 commit comments

Comments
 (0)