code: plan9front

Download patch

ref: ba20914d0158f7d5551785b1382efeaae98919cb
parent: c7fc69bd6a965a4cb8eca7c9d4a069fb271c68e2
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Dec 19 09:50:30 EST 2020

acme: use global user string variable instead of getuser()

--- a/sys/src/cmd/acme/acme.c
+++ b/sys/src/cmd/acme/acme.c
@@ -329,7 +329,7 @@
 
 	if(pipe(pfd) < 0)
 		error("can't create pipe");
-	sprint(acmeerrorfile, "/srv/acme.%s.%d", getuser(), mainpid);
+	sprint(acmeerrorfile, "/srv/acme.%s.%d", user, mainpid);
 	fd = create(acmeerrorfile, OWRITE, 0666);
 	if(fd < 0){
 		remove(acmeerrorfile);
--- a/sys/src/cmd/acme/dat.h
+++ b/sys/src/cmd/acme/dat.h
@@ -538,6 +538,7 @@
 Buffer		snarfbuf;
 Rectangle		nullrect;
 int			fsyspid;
+char			*user;
 char			*cputype;
 char			*objtype;
 char			*home;
--- a/sys/src/cmd/acme/disk.c
+++ b/sys/src/cmd/acme/disk.c
@@ -19,7 +19,7 @@
 	char buf[128];
 	int i, fd;
 
-	snprint(buf, sizeof buf, "/tmp/X%d.%.4sacme", getpid(), getuser());
+	snprint(buf, sizeof buf, "/tmp/X%d.%.4sacme", getpid(), user);
 	for(i='A'; i<='Z'; i++){
 		buf[5] = i;
 		if(access(buf, AEXIST) == 0)
--- a/sys/src/cmd/acme/rows.c
+++ b/sys/src/cmd/acme/rows.c
@@ -667,7 +667,7 @@
 		textinsert(&w->tag, w->tag.file->nc, r+n+1, nr-(n+1), TRUE);
 		if(ndumped >= 0){
 			/* simplest thing is to put it in a file and load that */
-			sprint(buf, "/tmp/d%d.%.4sacme", getpid(), getuser());
+			sprint(buf, "/tmp/d%d.%.4sacme", getpid(), user);
 			fd = create(buf, OWRITE|ORCLOSE, 0600);
 			if(fd < 0){
 				free(r);