diff options
author | dds <dds@FreeBSD.org> | 2003-07-23 22:00:08 +0000 |
---|---|---|
committer | dds <dds@FreeBSD.org> | 2003-07-23 22:00:08 +0000 |
commit | 58e19bb4ec15e593f6ee156a4b40097e63aea068 (patch) | |
tree | 7454fd70fb5a7dd09a3eaef4800268ec407af1e8 /lib/libc/sys/connect.2 | |
parent | 35f690e0f7250315347c2394bd8cb81bca4f5d26 (diff) | |
download | FreeBSD-src-58e19bb4ec15e593f6ee156a4b40097e63aea068.zip FreeBSD-src-58e19bb4ec15e593f6ee156a4b40097e63aea068.tar.gz |
Document an additional error return value. The connect(2) call can also
return EACCES on non-Unix domain sockets as demonstrated by the
following program:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int
main(int argc, char *argv[])
{
struct sockaddr_in rem_addr;
int sock;
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
perror("socket");
exit(1);
}
bzero((char *)&rem_addr, sizeof(rem_addr));
rem_addr.sin_family = AF_INET;
rem_addr.sin_addr.s_addr = INADDR_NONE;
rem_addr.sin_port = htons(10000);
if (connect(sock, (struct sockaddr *)&rem_addr,
sizeof(rem_addr)) < 0) {
perror("connect");
exit(1);
}
}
The call chain returning this value is probably:
kern/uipc_syscalls.c:connect
kern/uipc_socket.c:soconnect
netinet/tcp_usrreq.c:tcp_usr_connect
netinet/tcp_output.c:tcp_output
netinet/ip_output.c:ip_output
Reviewed by: schweikh (mentor)
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/sys/connect.2')
-rw-r--r-- | lib/libc/sys/connect.2 | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/sys/connect.2 b/lib/libc/sys/connect.2 index cfc6460..18a656b 100644 --- a/lib/libc/sys/connect.2 +++ b/lib/libc/sys/connect.2 @@ -121,6 +121,12 @@ for completion by selecting the socket for writing. The socket is non-blocking and a previous connection attempt has not yet been completed. +.It Bq Er EACCES +An attempt is made to connect to a broadcast address (obtained through the +.Dv INADDR_BROADCAST +constant or the +.Dv INADDR_NONE +return value) through a socket that does not provide broadcast functionality. .El .Pp The following errors are specific to connecting names in the UNIX domain. |