diff options
author | Pino Toscano <toscano.pino@tiscali.it> | 2011-12-06 00:30:30 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-12-06 01:25:15 +0100 |
commit | 0fb997733a0bb4e3f7a0c073c19a2e302be1fbae (patch) | |
tree | 0c83ad9daa089a7957e08a8f25c9d7c87041ecfc /pfinet/socket-ops.c | |
parent | a552d956e86682b4af80c8fa5e6cc48282fd5a28 (diff) |
Fix error values on socket creation
On socket creation, return the correct errno values, EPROTOTYPE and
EPROTONOSUPPORT, for invalid socket types and protocols.
* pfinet/socket-ops.c (S_socket_create): Correctly return EPROTOTYPE and
EPROTONOSUPPORT.
* pflocal/pf.c (S_socket_create): Correctly return EPROTOTYPE.
Diffstat (limited to 'pfinet/socket-ops.c')
-rw-r--r-- | pfinet/socket-ops.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pfinet/socket-ops.c b/pfinet/socket-ops.c index 02675425..b4172dc4 100644 --- a/pfinet/socket-ops.c +++ b/pfinet/socket-ops.c @@ -51,12 +51,14 @@ S_socket_create (struct trivfs_protid *master, /* Don't allow bogus SOCK_PACKET here. */ - if ((sock_type != SOCK_STREAM - && sock_type != SOCK_DGRAM - && sock_type != SOCK_SEQPACKET - && sock_type != SOCK_RAW) - || protocol < 0) - return EINVAL; + if (sock_type != SOCK_STREAM + && sock_type != SOCK_DGRAM + && sock_type != SOCK_SEQPACKET + && sock_type != SOCK_RAW) + return EPROTOTYPE; + + if (protocol < 0) + return EPROTONOSUPPORT; __mutex_lock (&global_lock); |