shithub: riscv

Download patch

ref: 4616c93e8d5fbb9fbedf3b2c16f5b86a21e834ac
parent: fe23dcefd4088a733c28edf07853dec63a24b0ad
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Oct 28 23:20:43 EDT 2014

cs: fix linefeeds in syslog(), cleanup

--- a/sys/src/cmd/ndb/cs.c
+++ b/sys/src/cmd/ndb/cs.c
@@ -251,14 +251,7 @@
 	USED(argc);
 	USED(argv);
 
-	rfork(RFREND|RFNOTEG);
-
-	snprint(servefile, sizeof(servefile), "#s/cs%s", ext);
 	snprint(netndb, sizeof(netndb), "%s/ndb", mntpt);
-	if(!justsetname){
-		unmount(servefile, mntpt);
-		remove(servefile);
-	}
 
 	fmtinstall('E', eipfmt);
 	fmtinstall('I', eipfmt);
@@ -269,6 +262,11 @@
 	netinit(0);
 
 	if(!justsetname){
+		snprint(servefile, sizeof(servefile), "#s/cs%s", ext);
+		unmount(servefile, mntpt);
+		remove(servefile);
+
+		rfork(RFREND|RFNOTEG);
 		csuser = estrdup(getuser());
 		mountinit(servefile, mntpt);
 		io();
@@ -1007,7 +1005,7 @@
 		ipmove(ipa, IPnoaddr);
 	sprint(ipaddr, "%I", ipa);
 	if (debug)
-		syslog(0, logfile, "ipaddr is %s\n", ipaddr);
+		syslog(0, logfile, "ipaddr is %s", ipaddr);
 }
 
 /*
@@ -1151,7 +1149,7 @@
 	ipid();
 
 	if(debug)
-		syslog(0, logfile, "mysysname %s eaddr %s ipaddr %s ipa %I\n",
+		syslog(0, logfile, "mysysname %s eaddr %s ipaddr %s ipa %I",
 			mysysname?mysysname:"???", eaddr, ipaddr, ipa);
 
 	if(background){