From 3ca1542b8019f244664e0d93ca54ed322bf4bf6c Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Sat, 20 Sep 1980 00:16:13 -0800 Subject: [PATCH] avoid ETXTBSY botch SCCS-vsn: sys/kern/kern_proc.c 3.21 --- usr/src/sys/kern/kern_proc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/usr/src/sys/kern/kern_proc.c b/usr/src/sys/kern/kern_proc.c index edae387630..879bd93848 100644 --- a/usr/src/sys/kern/kern_proc.c +++ b/usr/src/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* kern_proc.c 3.20 %G% */ +/* kern_proc.c 3.21 %G% */ #include "../h/param.h" #include "../h/systm.h" @@ -18,6 +18,7 @@ #include "../h/text.h" #include "../h/psl.h" #include "../h/vlimit.h" +#include "../h/file.h" /* * exec system call, with and without environments. @@ -177,7 +178,7 @@ register struct inode *ip; { register sep; register size_t ts, ds, ss; - register int overlay; + int overlay; int pagi = 0; /* @@ -242,8 +243,13 @@ register struct inode *ip; goto bad; } if(u.u_exdata.ux_tsize!=0 && (ip->i_flag&ITEXT)==0 && ip->i_count!=1) { - u.u_error = ETXTBSY; - goto bad; + register struct file *fp; + + for (fp = file; fp < &file[NFILE]; fp++) + if (fp->f_inode == ip && (fp->f_flag&FWRITE)) { + u.u_error = ETXTBSY; + goto bad; + } } /* -- 2.20.1