only call the device close routine on a (fall-through) error if

F_NODEV isn't set in the file flags for the file being opened.
Pointed out by Matthias Drochner in PR 3122.  (fix equivalent to
the one he included, but stylistically different.)
This commit is contained in:
cgd 1997-01-17 20:03:53 +00:00
parent 9be91c7fb4
commit 9596fd8a77
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: open.c,v 1.12 1996/09/30 16:01:21 ws Exp $ */
/* $NetBSD: open.c,v 1.13 1997/01/17 20:03:53 cgd Exp $ */
/*-
* Copyright (c) 1993
@ -119,7 +119,8 @@ fnd:
if (!error)
error = ENOENT;
f->f_dev->dv_close(f);
if ((f->f_flags & F_NODEV) == 0)
f->f_dev->dv_close(f);
err:
f->f_flags = 0;
errno = error;