mirror of
https://github.com/tmux/tmux.git
synced 2025-01-05 23:38:48 +00:00
Daemonise before loading configuration.
This commit is contained in:
parent
70dc1b10f2
commit
259dcbbc93
13
server.c
13
server.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: server.c,v 1.47 2008-06-02 21:08:36 nicm Exp $ */
|
/* $Id: server.c,v 1.48 2008-06-02 21:16:21 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -78,6 +78,13 @@ server_start(const char *path)
|
|||||||
xmalloc_clear();
|
xmalloc_clear();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
fatal("daemon failed");
|
||||||
|
|
||||||
ARRAY_INIT(&windows);
|
ARRAY_INIT(&windows);
|
||||||
ARRAY_INIT(&clients);
|
ARRAY_INIT(&clients);
|
||||||
ARRAY_INIT(&sessions);
|
ARRAY_INIT(&sessions);
|
||||||
@ -120,10 +127,6 @@ server_start(const char *path)
|
|||||||
fatal("fcntl failed");
|
fatal("fcntl failed");
|
||||||
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
|
||||||
fatal("fcntl failed");
|
fatal("fcntl failed");
|
||||||
|
|
||||||
if (daemon(1, 1) != 0)
|
|
||||||
fatal("daemon failed");
|
|
||||||
log_debug("server daemonised, pid now %ld", (long) getpid());
|
|
||||||
|
|
||||||
n = server_main(path, fd);
|
n = server_main(path, fd);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user