shithub: neinchat

Download patch

ref: b314c7b701080d882249e0f793708f216564e79d
parent: 29bcaa927a15091164661069e56da7c2431f7a33
author: Peter Mikkelsen <petermikkelsen10@gmail.com>
date: Sat Feb 13 07:43:26 EST 2021

Remove one more global variable

--- a/main.c
+++ b/main.c
@@ -40,8 +40,6 @@
 void	fillstat(Dir*, NeinFile);
 void	readchanlog(Req*, uvlong);
 
-char *username;
-
 NeinFile qroot[] = {
 	"nickname", {Qnickname, 0, QTFILE}, 0666,
 	"speak", {Qspeak, 0, QTFILE}, 0222,
@@ -67,7 +65,6 @@
 	};
 	char *postname = "neinchat";
 	char *addr = "tcp!*!12345";
-	username = getuser();
 	nchannels = 0;
 	channels = nil;
 	print("Starting neinchat server on %s and posting to /srv/%s\n", addr, postname);
@@ -288,6 +285,7 @@
 void
 fillstat(Dir *d, NeinFile f)
 {
+	char *username = getuser();
 	d->qid = f.qid;
 	d->mode = f.mode;
 	d->length = 0;