shithub: riscv

Download patch

ref: c7fc69bd6a965a4cb8eca7c9d4a069fb271c68e2
parent: 672cf179a1a8a17a4a977eeada60a035a27ed98d
author: cinap_lenrek <[email protected]>
date: Sat Dec 19 10:36:07 EST 2020

acme: use getuser() in fsinit()

--- a/sys/src/cmd/acme/fsys.c
+++ b/sys/src/cmd/acme/fsys.c
@@ -116,8 +116,6 @@
 fsysinit(void)
 {
 	int p[2];
-	int n, fd;
-	char buf[256];
 
 	if(pipe(p) < 0)
 		error("can't create pipe");
@@ -125,15 +123,7 @@
 	sfd = p[1];
 	fmtinstall('F', fcallfmt);
 	clockfd = open("/dev/time", OREAD|OCEXEC);
-	fd = open("/dev/user", OREAD);
-	if(fd >= 0){
-		n = read(fd, buf, sizeof buf-1);
-		if(n > 0){
-			buf[n] = 0;
-			user = estrdup(buf);
-		}
-		close(fd);
-	}
+	user = getuser();
 	proccreate(fsysproc, nil, STACK);
 }