Deleted Added
full compact
server.c (31921) server.c (31962)
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id$
26 * $Id: server.c,v 1.14 1997/12/21 12:11:08 brian Exp $
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <netinet/in.h>
32#include <arpa/inet.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>

--- 47 unchanged lines hidden (view full) ---

82 s = ID0socket(PF_LOCAL, SOCK_STREAM, 0);
83 if (s < 0) {
84 LogPrintf(LogERROR, "Local: socket: %s\n", strerror(errno));
85 return 3;
86 }
87 setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s);
88 if (mask != (mode_t)-1)
89 mask = umask(mask);
27 */
28
29#include <sys/param.h>
30#include <sys/socket.h>
31#include <netinet/in.h>
32#include <arpa/inet.h>
33#include <netinet/in_systm.h>
34#include <netinet/ip.h>

--- 47 unchanged lines hidden (view full) ---

82 s = ID0socket(PF_LOCAL, SOCK_STREAM, 0);
83 if (s < 0) {
84 LogPrintf(LogERROR, "Local: socket: %s\n", strerror(errno));
85 return 3;
86 }
87 setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s);
88 if (mask != (mode_t)-1)
89 mask = umask(mask);
90 if (bind(s, (struct sockaddr *) & ifsun, sizeof(ifsun)) < 0) {
90 if (bind(s, (struct sockaddr *)&ifsun, sizeof ifsun) < 0) {
91 if (mask != (mode_t)-1)
92 umask(mask);
93 LogPrintf(LogERROR, "Local: bind: %s\n", strerror(errno));
94 if (errno == EADDRINUSE && VarTerm)
95 fprintf(VarTerm, "Wait for a while, then try again.\n");
96 close(s);
97 return 4;
98 }

--- 34 unchanged lines hidden (view full) ---

133 LogPrintf(LogERROR, "Tcp: socket: %s\n", strerror(errno));
134 return 7;
135 }
136 memset(&ifsin, '\0', sizeof ifsin);
137 ifsin.sin_family = AF_INET;
138 ifsin.sin_addr.s_addr = INADDR_ANY;
139 ifsin.sin_port = htons(port);
140 setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s);
91 if (mask != (mode_t)-1)
92 umask(mask);
93 LogPrintf(LogERROR, "Local: bind: %s\n", strerror(errno));
94 if (errno == EADDRINUSE && VarTerm)
95 fprintf(VarTerm, "Wait for a while, then try again.\n");
96 close(s);
97 return 4;
98 }

--- 34 unchanged lines hidden (view full) ---

133 LogPrintf(LogERROR, "Tcp: socket: %s\n", strerror(errno));
134 return 7;
135 }
136 memset(&ifsin, '\0', sizeof ifsin);
137 ifsin.sin_family = AF_INET;
138 ifsin.sin_addr.s_addr = INADDR_ANY;
139 ifsin.sin_port = htons(port);
140 setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &s, sizeof s);
141 if (bind(s, (struct sockaddr *) & ifsin, sizeof(ifsin)) < 0) {
141 if (bind(s, (struct sockaddr *)&ifsin, sizeof ifsin) < 0) {
142 LogPrintf(LogERROR, "Tcp: bind: %s\n", strerror(errno));
143 if (errno == EADDRINUSE && VarTerm)
144 fprintf(VarTerm, "Wait for a while, then try again.\n");
145 close(s);
146 return 8;
147 }
148 if (listen(s, 5) != 0) {
149 LogPrintf(LogERROR, "Tcp: Unable to listen to socket - OS overload?\n");

--- 21 unchanged lines hidden ---
142 LogPrintf(LogERROR, "Tcp: bind: %s\n", strerror(errno));
143 if (errno == EADDRINUSE && VarTerm)
144 fprintf(VarTerm, "Wait for a while, then try again.\n");
145 close(s);
146 return 8;
147 }
148 if (listen(s, 5) != 0) {
149 LogPrintf(LogERROR, "Tcp: Unable to listen to socket - OS overload?\n");

--- 21 unchanged lines hidden ---