Subject: Re: Addition to force open to open only regular files
To: Bill Studenmund <>
From: Olaf Seibert <>
List: tech-kern
Date: 11/17/2000 14:13:57
On Mon 13 Nov 2000 at 08:30:09 -0800, Bill Studenmund wrote:
> On Fri, 10 Nov 2000, Greywolf wrote:
> > If you're concerned about the type of file you're opening, OPEN the thing
> > and then fstat(fd) it.  If it's not the right type, act appropriately,
> > whether that means looping on trying to open something (based on user
> > input) or abort and bitch.
> The point is that by the time you can do the fstat(), for a number of
> things, IT IS TOO LATE.

The obvious solution, although maybe not very Unixy, is to split the
open(2) operation. First the kernel does the lookup, then the user
program does some validation, then the open continues. This can be done
with 2 syscalls, or a callback. Or maybe a "open this file only if it is
the same as this stat()ed one" call (hm, that is basically the first
version again I suppose). This is at least more general than an "open
only regular files" call.

___ Olaf 'Rhialto' Seibert - rhialto@polder    -- Ah only did well at school
\X/       -- tae git intae an O level class tae git away fae Begbie.
Hi! I am a .signature virus. Copy me into your .signature to help me spread.