summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-02-09 00:27:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-02-09 00:27:50 +0000
commit1d64a5472959f13641b9f00318618b072567bbdd (patch)
treebbe988143d026bfa397cfd2fd62514cba18f31bd /sys
parent48cc0137de52cf0bef3ed72ba03291ea021eb448 (diff)
Protect the whole sys_fnctl with one big FREF/FRELE pair.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_descrip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 62e376ef291..b7e1f7c48a0 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.51 2002/02/08 18:43:54 art Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.52 2002/02/09 00:27:49 art Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -313,6 +313,7 @@ sys_fcntl(p, v, retval)
restart:
if ((fp = fd_getfile(fdp, fd)) == NULL)
return (EBADF);
+ FREF(fp);
switch (SCARG(uap, cmd)) {
case F_DUPFD:
@@ -322,14 +323,15 @@ restart:
error = EINVAL;
break;
}
- FREF(fp);
if ((error = fdalloc(p, newmin, &i)) != 0) {
if (error == ENOSPC) {
fdexpand(p);
+ FRELE(fp);
goto restart;
}
break;
}
+ /* finishdup will FRELE for us. */
return (finishdup(p, fp, fd, i, retval));
case F_GETFD:
@@ -487,6 +489,7 @@ restart:
break;
}
out:
+ FRELE(fp);
return (error);
}