summaryrefslogtreecommitdiff
path: root/network/redir/patches/05_pedantic.dpatch
blob: ff7b1a9fbf92b91f87429c6462ff347f753f673e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#! /bin/sh /usr/share/dpatch/dpatch-run
## 05_pedantic.dpatch by Daniel Kahn Gillmor <dkg@fifthhorseman.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: changes to make clean up compilation

@DPATCH@
diff -urNad redir-2.2.1~/Makefile redir-2.2.1/Makefile
--- redir-2.2.1~/Makefile	2005-10-22 23:11:41.000000000 -0400
+++ redir-2.2.1/Makefile	2005-10-22 23:11:48.818368360 -0400
@@ -32,7 +32,7 @@
 # if your system lacks getopt_long, remove the comment from this line
 OBJS = redir.o $(GETOPT_OBJS)
 
-CFLAGS = -O2 -Wall $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
+CFLAGS = -O2 -Wall --pedantic $(STR_CFLAGS) $(WRAP_CFLAGS) $(EXTRA_CFLAGS)
 LDFLAGS = -s
 
 # solaris, and others, may also need these libraries to link
diff -urNad redir-2.2.1~/redir.c redir-2.2.1/redir.c
--- redir-2.2.1~/redir.c	2005-10-22 23:11:48.282449832 -0400
+++ redir-2.2.1/redir.c	2005-10-22 23:12:23.201141384 -0400
@@ -73,6 +73,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/time.h>
+#include <time.h>
 #include <sys/wait.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -460,7 +461,7 @@
 	int lport, rport;
 	int remip[4];
 	int localsock;
-	int socksize = sizeof(struct sockaddr_in);
+	size_t socksize = sizeof(struct sockaddr_in);
 
 	struct sockaddr_in newsession;
 	struct sockaddr_in sockname;
@@ -509,7 +510,7 @@
 	if(getsockname(localsock, (struct sockaddr *)&sockname, &socksize) < 0) {
 		perror("getsockname");
 		if (dosyslog)
-			syslog(LOG_ERR, "getsockname failed: %m");
+			syslog(LOG_ERR, "getsockname failed: %s",strerror(errno));
 		exit(1);
 	}
 
@@ -562,7 +563,7 @@
 	switch(fork())
 	{
      	case -1: /* Error */
-     		syslog(LOG_ERR, "Couldn't fork: %m");
+     		syslog(LOG_ERR, "Couldn't fork: %s",strerror(errno));
      		_exit(1);
      	case 0:  /* Child */
 	{
@@ -723,7 +724,7 @@
 	int clisock;
 	int targetsock;
 	struct sockaddr_in client;
-	int clientlen = sizeof(client);
+	size_t clientlen = sizeof(client);
 	int accept_errno;
      
 	debug("top of accept loop\n");
@@ -734,7 +735,7 @@
 		perror("server: accept");
 
 		if (dosyslog)
-			syslog(LOG_ERR, "accept failed: %m");
+			syslog(LOG_ERR, "accept failed: %s",strerror(errno));
 
 		/* determine if this error is fatal */
 		switch(accept_errno) {
@@ -768,7 +769,7 @@
      		perror("(server) fork");
 
      		if (dosyslog)
-     			syslog(LOG_ERR, "(server) fork failed: %m");
+     			syslog(LOG_ERR, "(server) fork failed: %s",strerror(errno));
 
      		_exit(1);
      	case 0:  /* Child */
@@ -795,7 +796,7 @@
      		perror("(child) fork");
 
      		if (dosyslog)
-     			syslog(LOG_ERR, "(child) fork failed: %m");
+     			syslog(LOG_ERR, "(child) fork failed: %s",strerror(errno));
 
      		_exit(1);
      	case 0:  /* Child */
@@ -826,7 +827,7 @@
 		perror("target: socket");
 	  
 		if (dosyslog)
-			syslog(LOG_ERR, "socket failed: %m");
+			syslog(LOG_ERR, "socket failed: %s",strerror(errno));
 		
 		_exit(1);
 	}
@@ -850,7 +851,7 @@
    only be different if the input value is 0 (let the system pick a 
    port) */
 			if (dosyslog)
-				syslog(LOG_ERR, "bind failed: %m");
+				syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 			_exit(1);
 		}
@@ -862,7 +863,7 @@
 		perror("target: connect");
 
 		if (dosyslog)
-			syslog(LOG_ERR, "bind failed: %m");
+			syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 		_exit(1);
 	}
@@ -923,7 +924,7 @@
 			perror("server: socket");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "socket failed: %m");
+				syslog(LOG_ERR, "socket failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -962,7 +963,7 @@
 			perror("server: bind");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "bind failed: %m");
+				syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -980,7 +981,7 @@
 			perror("server: listen");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "listen failed: %m");
+				syslog(LOG_ERR, "listen failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -1059,7 +1060,7 @@
 	if (inetd) {
 		int targetsock;
 		struct sockaddr_in client;
-		int client_size = sizeof(client);
+		size_t client_size = sizeof(client);
 
 #ifdef USE_TCP_WRAPPERS
 		request_init(&request, RQ_DAEMON, ident, RQ_FILE, 0, 0);
@@ -1079,7 +1080,7 @@
 			perror("target: socket");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "targetsock failed: %m");
+				syslog(LOG_ERR, "targetsock failed: %s",strerror(errno));
 
 			exit(1);
 		}
@@ -1097,7 +1098,7 @@
 				perror("bind_addr: cannot bind to forcerd outgoing addr");
 				 
 				if (dosyslog)
-					syslog(LOG_ERR, "bind failed: %m");
+					syslog(LOG_ERR, "bind failed: %s",strerror(errno));
 				 
 				exit(1);
 			}
@@ -1109,7 +1110,7 @@
 			perror("target: connect");
 
 			if (dosyslog)
-				syslog(LOG_ERR, "connect failed: %m");
+				syslog(LOG_ERR, "connect failed: %s",strerror(errno));
 
 			exit(1);
 		}