Avoid calling device-close routine when open() not completed. Otherwise you
lose if this sequence occurs: open()->devopen()->...->panic()->closeall().
This commit is contained in:
parent
7e58b6088e
commit
07f70f97f1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: close.c,v 1.4 1994/10/26 05:44:40 cgd Exp $ */
|
||||
/* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -77,9 +77,9 @@ close(fd)
|
||||
errno = EBADF;
|
||||
return (-1);
|
||||
}
|
||||
if (!(f->f_flags & F_RAW))
|
||||
if (!(f->f_flags & F_RAW) && f->f_ops)
|
||||
err1 = (f->f_ops->close)(f);
|
||||
if (!(f->f_flags & F_NODEV))
|
||||
if (!(f->f_flags & F_NODEV) && f->f_dev)
|
||||
err2 = (f->f_dev->dv_close)(f);
|
||||
f->f_flags = 0;
|
||||
if (err1) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: open.c,v 1.6 1995/04/22 13:57:03 cgd Exp $ */
|
||||
/* $NetBSD: open.c,v 1.7 1995/09/06 19:53:27 pk Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -93,6 +93,7 @@ fnd:
|
||||
*/
|
||||
f->f_flags = mode + 1;
|
||||
f->f_dev = (struct devsw *)0;
|
||||
f->f_ops = (struct fs_ops *)0;
|
||||
file = (char *)0;
|
||||
error = devopen(f, fname, &file);
|
||||
if (error ||
|
||||
|
Loading…
Reference in New Issue
Block a user