git: 9front

Download patch

ref: e02e0af1b8a72fa868b360aa0401712c867f27b1
parent: 6ae7ecce5e2c4d15f1b6a777a9a67d94757004a7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jun 17 23:13:50 EDT 2015

kernel: do not inherit Proc.dot (current working directory) in kproc()

making sure to close the dot in every kproc appears repetitive,
so instead stop inheriting the dot in kproc() as this is usually
never what you wanted in the first place.

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -1387,7 +1387,7 @@
 	p->s = up->s;
 	p->nerrlab = 0;
 	p->slash = up->slash;
-	p->dot = up->dot;
+	p->dot = up->slash;	/* unlike fork, do not inherit the dot for kprocs */
 	if(p->dot != nil)
 		incref(p->dot);
 
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -837,10 +837,6 @@
 	incref(sio->s);
 	up->seg[sno] = sio->s;
 
-	cclose(up->dot);
-	up->dot = up->slash;
-	incref(up->dot);
-
 	while(waserror())
 		;
 	for(done = 0; !done;){
--- a/sys/src/9/port/swap.c
+++ b/sys/src/9/port/swap.c
@@ -149,10 +149,6 @@
 	Segment *s;
 	Proc *p, *ep;
 
-	cclose(up->dot);
-	up->dot = up->slash;
-	incref(up->dot);
-
 	p = proctab(0);
 	ep = &p[conf.nproc];
 
--- a/sys/src/9/zynq/screen.c
+++ b/sys/src/9/zynq/screen.c
@@ -116,10 +116,6 @@
 
 	up->seg[i] = arg;
 
-	cclose(up->dot);
-	up->dot = up->slash;
-	incref(up->dot);
-
 	hwcursor.proc = up;
 	if(waserror()){
 		hwcursor.addr = 0;
@@ -203,10 +199,6 @@
 		panic(up->text);
 
 	up->seg[sno] = arg;
-
-	cclose(up->dot);
-	up->dot = up->slash;
-	incref(up->dot);
 
 	fbscreen.proc = up;
 	if(waserror()){
--