From: Philip Homburg Date: Wed, 27 Jul 2005 12:01:11 +0000 (+0000) Subject: Do not accept requests from dead processes. X-Git-Tag: v3.1.0~517 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch05.html?a=commitdiff_plain;h=aa994b48ee0a6d86564a1bbad792ba4e1f840c51;p=minix.git Do not accept requests from dead processes. --- diff --git a/servers/fs/main.c b/servers/fs/main.c index d3403a730..988a25a76 100644 --- a/servers/fs/main.c +++ b/servers/fs/main.c @@ -81,6 +81,9 @@ PUBLIC void main() if (call_nr < 0 || call_nr >= NCALLS) { error = ENOSYS; printf("FS, warning illegal %d system call by %d\n", call_nr, who); + } else if (fp->fp_pid == PID_FREE) { + error = ENOSYS; + printf("FS, bad process, who = %d\n", who); } else { error = (*call_vec[call_nr])(); } diff --git a/servers/fs/misc.c b/servers/fs/misc.c index b34027880..0167b2a89 100644 --- a/servers/fs/misc.c +++ b/servers/fs/misc.c @@ -350,9 +350,15 @@ PUBLIC int do_exit() /* If a session leader exits then revoke access to its controlling tty from * all other processes using it. */ - if (!fp->fp_sesldr) return(OK); /* not a session leader */ + if (!fp->fp_sesldr) { + fp->fp_pid = PID_FREE; + return(OK); /* not a session leader */ + } fp->fp_sesldr = FALSE; - if (fp->fp_tty == 0) return(OK); /* no controlling tty */ + if (fp->fp_tty == 0) { + fp->fp_pid = PID_FREE; + return(OK); /* no controlling tty */ + } dev = fp->fp_tty; for (rfp = &fproc[0]; rfp < &fproc[NR_PROCS]; rfp++) {