aboutsummaryrefslogtreecommitdiff
path: root/pfinet/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'pfinet/socket.c')
-rw-r--r--pfinet/socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pfinet/socket.c b/pfinet/socket.c
index 52bd37ff..82935a57 100644
--- a/pfinet/socket.c
+++ b/pfinet/socket.c
@@ -59,9 +59,10 @@ sock_alloc (void)
}
/* Create a sock_user structure, initialized from SOCK and ISROOT.
- If NOINSTALL is set, don't put it in the portset. */
+ If NOINSTALL is set, don't put it in the portset.
+ We increment SOCK->refcnt iff CONSUME is zero. */
struct sock_user *
-make_sock_user (struct socket *sock, int isroot, int noinstall)
+make_sock_user (struct socket *sock, int isroot, int noinstall, int consume)
{
error_t err;
struct sock_user *user;
@@ -81,7 +82,8 @@ make_sock_user (struct socket *sock, int isroot, int noinstall)
in the original Linux structure), because there can be multiple
ports (struct sock_user, aka protids) pointing to the same socket.
The socket lives until all the ports die. */
- ++sock->refcnt;
+ if (! consume)
+ ++sock->refcnt;
user->isroot = isroot;
user->sock = sock;
return user;