shithub: plan9front

Download patch

ref: 956ff38121ca10af2fc33dd1700f29bb80bf716c
parent: e7a266a6354eda00d81ef3a7cad0153e4a3ff510
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Dec 18 17:21:23 EST 2022

cifs: use procsetname() instead of rolling your own

--- a/sys/src/cmd/cifs/main.c
+++ b/sys/src/cmd/cifs/main.c
@@ -50,9 +50,6 @@
 void
 setup(void)
 {
-	int fd;
-	char buf[32];
-
 	/*
 	 * This is revolting but I cannot see any other way to get
 	 * the pid of the server.  We need this as Windows doesn't
@@ -61,11 +58,7 @@
 	 */
 	Attachpid = getpid();
 
-	snprint(buf, sizeof buf, "#p/%d/args", getpid());
-	if((fd = open(buf, OWRITE)) >= 0){
-		fprint(fd, "%s network", Host);
-		close(fd);
-	}
+	procsetname("%s network", Host);
 }
 
 int
@@ -1135,15 +1128,10 @@
 static void
 keepalive(void)
 {
-	char buf[32];
 	uvlong tot, fre;
-	int fd, i, slot, rc;
+	int i, slot, rc;
 
-	snprint(buf, sizeof buf, "#p/%d/args", getpid());
-	if((fd = open(buf, OWRITE)) >= 0){
-		fprint(fd, "%s keepalive", Host);
-		close(fd);
-	}
+	procsetname("%s keepalive", Host);
 
 	rc = 0;
 	slot = 0;