shithub: riscv

Download patch

ref: 8f80e3d5df320af46887952662738fde6b1d84c8
parent: e51c4bc6e493a9cd0d9e9d7f1d24c57ae77bab65
author: cinap_lenrek <[email protected]>
date: Sun Dec 18 17:34:50 EST 2022

5e: access /proc instead of #p

--- a/sys/src/cmd/5e/fs.c
+++ b/sys/src/cmd/5e/fs.c
@@ -77,14 +77,20 @@
 	char *name, *buf;
 	int fd, rc;
 	
-	name = smprint("#p/%d/%s", pid, file);
+	name = smprint("/proc/%d/%s", pid, file);
 	fd = open(name, OREAD);
-	if(fd < 0)
+	if(fd < 0){
+		free(name);
 		return nil;
+	}
 	buf = malloc(1024);
 	rc = read(fd, buf, 1023);
-	if(rc < 0)
+	if(rc < 0){
+		free(buf);
+		free(name);
+		close(fd);
 		return nil;
+	}
 	buf[rc] = 0;
 	free(name);
 	close(fd);
@@ -383,7 +389,7 @@
 {
 	switch((int)(req->fid->qid.path % NQid)) {
 	case Qnote:
-		writeto(req, "#p/%lld/note", req->fid->qid.path / NQid);
+		writeto(req, "/proc/%lld/note", req->fid->qid.path / NQid);
 		break;
 	default:
 		respond(req, "the front fell off");