From ccae6e4c8a44b2d33992e05e4407e29adc592fa7 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sat, 13 Nov 2010 12:11:28 -0500 Subject: [PATCH] Clean up unnecessary goto exit handler in raw_socket(). --- ndhc/socket.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ndhc/socket.c b/ndhc/socket.c index f7b0aad..49a6be4 100644 --- a/ndhc/socket.c +++ b/ndhc/socket.c @@ -178,7 +178,7 @@ int raw_socket(int ifindex) log_line("Opening raw socket on ifindex %d", ifindex); if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) { log_error("socket call failed: %s", strerror(errno)); - goto out; + return -1; } if (SERVER_PORT == 67 && CLIENT_PORT == 68) { @@ -194,12 +194,9 @@ int raw_socket(int ifindex) sock.sll_ifindex = ifindex; if (bind(fd, (struct sockaddr *)&sock, sizeof(sock)) < 0) { log_error("bind call failed: %s", strerror(errno)); - goto out_fd; + close(fd); + return -1; } return fd; - out_fd: - close(fd); - out: - return -1; }