[PATCH] Wrong errno out of memory in open syscall
Guest section DW
dwguest en win.tue.nl
Sab Ene 29 00:56:57 CST 2000
On Fri, Jan 28, 2000 at 04:43:34PM +0000, Alan Cox wrote:
> > It's a simple one line patch, below.
> >
> > --- linux-2.3.40/fs/ext2/namei.c Fri Jan 28 16:23:32 2000
> > +++ linux/fs/ext2/namei.c Fri Jan 28 16:40:41 2000
> > @@ -176,7 +176,7 @@
> > inode = iget(dir->i_sb, ino);
> >
> > if (!inode)
> > - return ERR_PTR(-EACCES);
> > + return ERR_PTR(-ENOMEM);
> > }
> > d_add(dentry, inode);
> > return NULL;
>
> ENOMEM isnt a valid return to open() except for a streams file. Quite why
> SuS specifies this I dont know.
Alan, I disagree. Let me quote SuS.
Error Numbers (3.3):
Implementations may support additional errors not included in this list,
may generate errors included in this list under circumstances other than
described here, ...
Implementations do not generate a different error number from the ones
described here for error conditions described in this document, but may
generate additional errors ...
Thus: if open fails because of lack of memory, the natural thing
to do is to return ENOMEM, and a very confusing thing to do is
to return EACCES.
I have not checked the precise cause of error in this particular case,
but if it really is lack of memory then both the old and the new
situation are admissible, and the new (patched) version is preferable.
Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo en vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Más información sobre la lista de distribución Ayuda