shutdown.c (256281) | shutdown.c (281974) |
---|---|
1/*- 2 * Copyright (C) 2005 The FreeBSD Project. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * | 1/*- 2 * Copyright (C) 2005 The FreeBSD Project. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * |
25 * $FreeBSD: stable/10/tools/regression/sockets/shutdown/shutdown.c 150156 2005-09-15 13:20:39Z maxim $ | 25 * $FreeBSD: stable/10/tools/regression/sockets/shutdown/shutdown.c 281974 2015-04-25 05:31:52Z ngie $ |
26 */ 27 28#include <sys/types.h> 29#include <sys/socket.h> 30 31#include <netinet/in.h> 32#include <arpa/inet.h> 33 --- 6 unchanged lines hidden (view full) --- 40int 41main(void) 42{ 43 struct sockaddr_in sock; 44 socklen_t len; 45 int listen_sock, connect_sock; 46 u_short port; 47 | 26 */ 27 28#include <sys/types.h> 29#include <sys/socket.h> 30 31#include <netinet/in.h> 32#include <arpa/inet.h> 33 --- 6 unchanged lines hidden (view full) --- 40int 41main(void) 42{ 43 struct sockaddr_in sock; 44 socklen_t len; 45 int listen_sock, connect_sock; 46 u_short port; 47 |
48 listen_sock = -1; 49 |
|
48 /* Shutdown(2) on an invalid file descriptor has to return EBADF. */ 49 if ((shutdown(listen_sock, SHUT_RDWR) != -1) && (errno != EBADF)) 50 errx(-1, "shutdown() for invalid file descriptor does not " 51 "return EBADF"); 52 53 listen_sock = socket(PF_INET, SOCK_STREAM, 0); 54 if (listen_sock == -1) 55 errx(-1, --- 53 unchanged lines hidden --- | 50 /* Shutdown(2) on an invalid file descriptor has to return EBADF. */ 51 if ((shutdown(listen_sock, SHUT_RDWR) != -1) && (errno != EBADF)) 52 errx(-1, "shutdown() for invalid file descriptor does not " 53 "return EBADF"); 54 55 listen_sock = socket(PF_INET, SOCK_STREAM, 0); 56 if (listen_sock == -1) 57 errx(-1, --- 53 unchanged lines hidden --- |