Fix bug observed by Perry and myself: when emacs was shut down

uncleanly due to a lost connection, it would hang in closef() waiting
for the usecount to go back to 1.

An audit of FILE_USE() vs FILE_UNUSE() usage led me to discover some
incorrect error-path code..

In sys_fcntl(), avoid leaking a file descriptor usecount in an error
case of F_SETFL; don't return, instead go to "out" to clean up.  I
suspect that the F_SETFL would fail because vop_fcntl is not
implemented in deadfs.
This commit is contained in:
sommerfeld 1999-12-08 18:53:56 +00:00
parent 73332d1d4c
commit c3ddfa524d
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_descrip.c,v 1.61 1999/08/03 20:19:16 wrstuden Exp $ */
/* $NetBSD: kern_descrip.c,v 1.62 1999/12/08 18:53:56 sommerfeld Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -264,7 +264,7 @@ sys_fcntl(p, v, retval)
tmp = FFLAGS((long)SCARG(uap, arg)) & FCNTLFLAGS;
error = (*fp->f_ops->fo_fcntl)(fp, F_SETFL, (caddr_t)&tmp, p);
if (error)
return (error);
goto out;
fp->f_flag &= ~FCNTLFLAGS;
fp->f_flag |= tmp;
tmp = fp->f_flag & FNONBLOCK;