[mw-devel] MW3 r1317 - in trunk: . src/server

tswsl1989 at sucs.org tswsl1989 at sucs.org
Wed Dec 12 22:40:18 GMT 2012


Author: tswsl1989
Date: 2012-12-12 22:40:18 +0000 (Wed, 12 Dec 2012)
New Revision: 1317

Modified:
   trunk/mw.spec
   trunk/src/server/mwserv.c
Log:
Try and create/truncate who file before becoming a daemon to avoid silent failure

Server will now exit if unable to open who list.
mw.spec now includes build dependency for postgresql-devel



Modified: trunk/mw.spec
===================================================================
--- trunk/mw.spec	2012-12-12 20:42:50 UTC (rev 1316)
+++ trunk/mw.spec	2012-12-12 22:40:18 UTC (rev 1317)
@@ -11,7 +11,7 @@
 Requires(post): systemd-units
 Requires(preun): systemd-units
 Requires(postun): systemd-units
-BuildRequires: libtermcap-devel readline-devel glibc-devel sqlite-devel js-devel curl-devel openssl-devel jansson-devel
+BuildRequires: libtermcap-devel readline-devel glibc-devel sqlite-devel js-devel curl-devel openssl-devel jansson-devel postgresql-devel
 URL: http://projects.sucs.org/projects/mw/
 
 %description
@@ -83,6 +83,9 @@
 %doc %{_libdir}/mw/README
 
 %changelog
+* Wed Dec 12 2012 Thomas Lake <tswsl1989 at sucs.org>
+- Add build dependency for postgresql-devel
+
 * Sat Dec 08 2012 Andrew Price <welshbyte at sucs.org>
 - Bump to 2.17.* and add mwserv-related files
 

Modified: trunk/src/server/mwserv.c
===================================================================
--- trunk/src/server/mwserv.c	2012-12-12 20:42:50 UTC (rev 1316)
+++ trunk/src/server/mwserv.c	2012-12-12 22:40:18 UTC (rev 1317)
@@ -117,12 +117,16 @@
 		}
 	}
 
-	if (!opts.foreground) daemon(0,0);
-
 	/* at server start nobody is logged in, wipe who list */
 	int fd = openwhofile(O_TRUNC|O_WRONLY);
+	if (fd < 0) {
+		fprintf(stderr, "Failed to open who list\n");
+		return 1;
+	}
 	close(fd);
 
+	if (!opts.foreground) daemon(0,0);
+
 	uptime = time(0);
 	watch_mainsock(mainsock);
 	printf("Done.\n");




More information about the mw-devel mailing list