From 68a5d5c00be0e0445e72c2e960588d21c4494467 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 4 Oct 2007 11:52:03 +0000 Subject: Window attachment, malloc debugging, fix a segfault with no sessions. --- server.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'server.c') diff --git a/server.c b/server.c index c6684ec4..fb033f87 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.22 2007-10-04 00:02:10 nicm Exp $ */ +/* $Id: server.c,v 1.23 2007-10-04 11:52:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -62,7 +62,7 @@ server_start(char *path) size_t sz; pid_t pid; mode_t mask; - int fd, mode; + int n, fd, mode; switch (pid = fork()) { case -1: @@ -74,6 +74,8 @@ server_start(char *path) return (0); } + xmalloc_clear(); + logfile("server"); setproctitle("server (%s)", path); log_debug("server started, pid %ld", (long) getpid()); @@ -103,15 +105,15 @@ server_start(char *path) if (fcntl(fd, F_SETFL, mode|O_NONBLOCK) == -1) fatal("fcntl failed"); - /* - * Detach into the background. This means the PID changes which will - * have to be fixed in some way at some point... XXX - */ if (daemon(1, 1) != 0) fatal("daemon failed"); log_debug("server daemonised, pid now %ld", (long) getpid()); - exit(server_main(path, fd)); + n = server_main(path, fd); +#ifdef DEBUG + xmalloc_report(getpid(), "server"); +#endif + exit(n); } /* Main server loop. */ -- cgit