summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorart <art@openbsd.org>2002-02-08 13:53:27 +0000
committerart <art@openbsd.org>2002-02-08 13:53:27 +0000
commit43c6a78befebd24f220c7d68787d20a6f035d4fe (patch)
tree04d50079db715a2bbe95431b803233d4950c68c1 /sys/kern/sys_pipe.c
parentThere are NFS servers where it's possible to modify a symbolic link. Remove aggressive optimization (diff)
downloadwireguard-openbsd-43c6a78befebd24f220c7d68787d20a6f035d4fe.tar.xz
wireguard-openbsd-43c6a78befebd24f220c7d68787d20a6f035d4fe.zip
- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't have
the same semantics as NetBSD anyway, so it's good to avoid name collissions. - Always fdremove before freeing the file, not the other way around. - falloc FREFs the file. - have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to falloc FREFing the file). - Use closef as much as possible instead of ffree in error paths of falloc:ing functions. closef is much more careful with the fd and can deal with the fd being forcibly closed by dup2. Also try to avoid manually calling *fo_close when closef can do that for us (this makes some error paths mroe complicated (sys_socketpair and sys_pipe), but others become simpler (sys_open)).
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index 4543cbe9678..52e6dbbbb30 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.41 2002/01/23 00:39:47 art Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.42 2002/02/08 13:53:28 art Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -146,11 +146,13 @@ sys_opipe(p, v, retval)
FILE_SET_MATURE(wf);
return (0);
free3:
- ffree(rf);
fdremove(fdp, retval[0]);
+ closef(rf, p);
+ rpipe = NULL;
free2:
(void)pipeclose(wpipe);
- (void)pipeclose(rpipe);
+ if (rpipe != NULL)
+ (void)pipeclose(rpipe);
return (error);
}