Pick up cwd from environment,.

This commit is contained in:
Nicholas Marriott
2009-01-10 19:37:35 +00:00
parent 88ab74ac20
commit 4d71164826
13 changed files with 86 additions and 40 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.92 2009-01-10 19:35:40 nicm Exp $ */
/* $Id: server.c,v 1.93 2009-01-10 19:37:35 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -101,7 +101,7 @@ server_start(const char *path)
* Must daemonise before loading configuration as the PID changes so
* $TMUX would be wrong for sessions created in the config file.
*/
if (daemon(1, 1) != 0)
if (daemon(0, 1) != 0)
fatal("daemon failed");
ARRAY_INIT(&windows);
@ -590,6 +590,9 @@ server_lost_client(struct client *c)
xfree(ARRAY_ITEM(&c->prompt_hdata, i));
ARRAY_FREE(&c->prompt_hdata);
if (c->cwd != NULL)
xfree(c->cwd);
close(c->fd);
buffer_destroy(c->in);
buffer_destroy(c->out);