summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-04 22:07:28 +0000
committerMiles Bader <miles@gnu.org>1997-02-04 22:07:28 +0000
commitc2fd83a7b9bcbdd989ba59ba5094a2b5676729ad (patch)
treea1c1ee5e65a909f48021fde1aa8635677194c651
parent21c722e945ca7f8063a2e429315989cd82c85489 (diff)
(S_socket_bind):
Return EADDRNOTAVAIL if ADDR is 0. (S_socket_send): Don't deref ADDR if it's 0.
-rw-r--r--pfinet/socket-ops.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/pfinet/socket-ops.c b/pfinet/socket-ops.c
index 68e0ea80..d9a20263 100644
--- a/pfinet/socket-ops.c
+++ b/pfinet/socket-ops.c
@@ -1,5 +1,5 @@
/* Interface functions for the socket.defs interface.
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -205,7 +205,9 @@ S_socket_bind (struct sock_user *user,
if (!user)
return EOPNOTSUPP;
-
+ if (! addr)
+ return EADDRNOTAVAIL;
+
mutex_lock (&global_lock);
become_task (user);
err = - (*user->sock->ops->bind) (user->sock, addr->address, addr->len);
@@ -430,7 +432,7 @@ S_socket_send (struct sock_user *user,
mutex_unlock (&global_lock);
/* MiG should do this for us, but it doesn't. */
- if (sent >= 0)
+ if (addr && sent >= 0)
mach_port_deallocate (mach_task_self (), addr->pi.port_right);
if (sent >= 0)
@@ -504,4 +506,3 @@ S_socket_recv (struct sock_user *user,
return 0;
}
-