Subject: Re: access(2) error returns: ETXTBSY vs. read-only
To: dolecek@ics.muni.cz, Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
From: Ignatios Souvatzis <ignatios@cs.uni-bonn.de>
List: tech-kern
Date: 06/17/1999 12:16:14
On Wed, Jun 16, 1999 at 05:58:10PM +0300, Jaromir Dolecek wrote:
> Ignatios Souvatzis wrote:
> > As far as I can tell, this is caused by these lines in
> > vfs_syscalls.c::sys_access()
> >
> > 1543 if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
> > 1544 error = VOP_ACCESS(vp, flags, cred, p);
> >
> > Therefore, I'm wondering if reversing the tests like this:
> >
> > 1543 if ((flags & VWRITE) == 0 ||
> > 1544 (error = VOP_ACCESS(vp, flags, cred, p)) == 0)
> > 1545 error = vn_writechk(vp);
> >
>
> Your code mistakely doesn't call VOP_ACCESS() when (flags & VWRITE) ==
> 0).
>
> The code shoould be IMHO like:
> error = VOP_ACCESS(vp, flags, cred, p);
> if (!error && (flags & VWRITE))
> error = vn_writechk(vp);
You're right. I'm going to test this on a life system for a couple of days.
-is
--
* Progress (n.): The process through which Usenet has evolved from
smart people in front of dumb terminals to dumb people in front of
smart terminals. -- obs@burnout.demon.co.uk (obscurity)