Skip to content

Commit

Permalink
credential-cache--daemon: change to the socket dir on startup
Browse files Browse the repository at this point in the history
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 <peff@peff.net>
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jon Griffiths authored and Junio C Hamano committed Feb 23, 2016
1 parent bd93b8d commit 6e61449
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions credential-cache--daemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ static void init_socket_directory(const char *path)
if (mkdir(dir, 0700) < 0)
die_errno("unable to mkdir '%s'", dir);
}

if (chdir(dir))
/*
* We don't actually care what our cwd is; we chdir here just to
* be a friendly daemon and avoid tying up our original cwd.
* If this fails, it's OK to just continue without that benefit.
*/
;

free(path_copy);
}

Expand Down

0 comments on commit 6e61449

Please sign in to comment.