summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/vfs_syscalls.c')
-rw-r--r--sys/kern/vfs_syscalls.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 2cca22e..3a4ff54 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -996,11 +996,6 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
}
/*
- * release our own reference
- */
- fdrop(fp, td);
-
- /*
* handle special fdopen() case. bleh. dupfdopen() is
* responsible for dropping the old contents of ofiles[indx]
* if it succeeds.
@@ -1010,6 +1005,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
(error =
dupfdopen(td, fdp, indx, td->td_dupfd, flags, error)) == 0) {
td->td_retval[0] = indx;
+ fdrop(fp, td);
return (0);
}
/*
@@ -1017,6 +1013,7 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags,
* replaced or closed it.
*/
fdclose(fdp, fp, indx, td);
+ fdrop(fp, td);
if (error == ERESTART)
error = EINTR;
OpenPOWER on IntegriCloud