Author: Andreas Tille <tille@debian.org>
Last-Update: 2025-08-29
Bug-Debian: https://bugs.debian.org/1097453
Description: Fix build with gcc-15

--- a/common.h
+++ b/common.h
@@ -39,45 +39,45 @@ extern int	nfds;
 extern int	how_shutdown;
 
 /* add a file descriptor to the list */
-void add_fd(/* int fd */);
+void add_fd(int fd);
 
 /* add a file descriptor to the list */
-void reserve_fds(/* int placeholder */);
+void reserve_fds(int placeholder);
 
 /* do the dup from the argument socket to the list of file descriptors,
    perform the requested shutdown... */
-void dup_n(/*int socket */);
+void dup_n(int socket);
 
 /**********************************************************************/
 
-int get_port(/* struct sockaddr_storage * */);
-void set_port(/* struct sockaddr_storage *, int */);
+int get_port(struct sockaddr_storage * );
+void set_port(struct sockaddr_storage *, int );
 
-int name_to_inet_port(/* char* */);
+int name_to_inet_port(char* );
 
 /**********************************************************************/
 
 struct sockaddr_storage ** /* addr_array */
-convert_hostname(/* char *, int * */);
+convert_hostname(char *, int * );
 
 /**********************************************************************/
 
 void
-printhost(/* FILE, struct sockaddr * */);
+printhost(FILE *fp, struct sockaddr *addr);
 
 /**********************************************************************/
 
 int
-bindlocal(/* int, char *, char*, int, int */);
+bindlocal(int, char *, char*, int, int );
 
 /**********************************************************************/
 
 void				/* this is in version.c */
-emit_version(/* char*, int */);
+emit_version(char *progtitle, int beginyear);
 
 				/* this is also in version.c */
 extern char *progname;
-void set_progname(/* char *argv0 */);
+void set_progname(const char *progname);
 
 /* system dependencies */
 
@@ -86,7 +86,7 @@ void set_progname(/* char *argv0 */);
 /* no definition of sys_errlist in errno.h */
 extern char *sys_errlist[];
 
-char * strerror(/*int*/);
+char * strerror(int);
 #endif
 
 #ifdef POSIX_SIG
@@ -102,6 +102,6 @@ char * strerror(/*int*/);
 #define signal(a, b) sigset(a, b)
 #endif
 
-int valid_descriptor(/*int fd */);
+int valid_descriptor(int fd);
 
 #endif /* common_h_ */
--- a/getpeername.c
+++ b/getpeername.c
@@ -20,7 +20,6 @@
 
     */
 
-static char info[] = "getpeername: a network utility for sockets\nWritten 1995-98 by Robert Forsman <thoth@cis.ufl.edu>\n";
 #include	<stdio.h>
 #include	<string.h>
 #include	<errno.h>
@@ -42,12 +41,7 @@ void usage()
     fprintf(stderr, "Usage: %s [ -verbose ] [ fd# ]\n", progname);
 }
 
-int getpeername();
-int getsockname();
-
-int main(argc, argv)
-    int argc;
-    char **argv;
+int main(int argc, char **argv)
 {
     int	i;
     int	peer_not_sock = 1;
@@ -103,8 +97,7 @@ int main(argc, argv)
 #ifndef NOUNIXSOCKETS
 	struct sockaddr_un	*sunp = &saddr.un;
 #endif
-	int	saddrlen = sizeof(saddr);
-	int (*f)();
+	int	(*f)(int, struct sockaddr *restrict, socklen_t *restrict);
 	char	*name;
 
 	if (peer_not_sock) {
@@ -117,7 +110,8 @@ int main(argc, argv)
 
 	memset(&saddr, 0, sizeof(saddr));
 
-	if (0!= f(fd, &saddr, &saddrlen)) {
+	socklen_t saddrlen = sizeof(saddr);
+	if (0!= f(fd, (struct sockaddr *)&saddr, &saddrlen)) {
 	    fprintf(stderr, "%s: get%sname failed on descriptor %d: ", progname, name, fd);
 	    perror("");
 	    exit(1);
--- a/version.c
+++ b/version.c
@@ -28,8 +28,7 @@
 
 char *progname;
 
-void set_progname(argv0)
-     char *argv0;
+void set_progname(char *argv0)
 {
     char	*cp;
     progname = argv0;
@@ -39,9 +38,7 @@ void set_progname(argv0)
 
 /**********************************************************************/
 
-void emit_version(progtitle, beginyear)
-    char *progtitle;
-    int beginyear;
+void emit_version(char *progtitle, int beginyear)
 {
     int	thisyear=1998;
     fprintf(stderr, "%s; of netpipes version 4.2, ", progtitle);
--- a/sockdown.c
+++ b/sockdown.c
@@ -31,15 +31,11 @@ static char info[] = "sockdown: a networ
 #include "common.h"
 
 
-void				/* this is in version.c */
-emit_version(/* char*, int */);
 
 
 extern char *progname;
 
-int main(argc, argv)
-    int	argc;
-    char **argv;
+int main(int argc, char **argv)
 {
     int	fd;
     int	how;
--- a/common.c
+++ b/common.c
@@ -47,8 +47,7 @@ int	fdsize=0;
 
 int how_shutdown = -2;
 
-void add_fd(fd)
-    int	fd;
+void add_fd(int fd)
 {
     if (fds==0) {
 	fds = (int*)malloc(sizeof(*fds)*(fdsize=4));
@@ -67,8 +66,8 @@ void add_fd(fd)
 	dup2(0, fd);
 }
 
-void reserve_fds(placeholder)
-     int	placeholder;	/* I usually pass in 0, assuming that
+void reserve_fds(int placeholder)
+     				/* I usually pass in 0, assuming that
 				   the process will have a stdin, even
 				   if it's attached to /dev/null */
 {
@@ -79,8 +78,7 @@ void reserve_fds(placeholder)
     }
 }
 
-void dup_n(socket)
-    int	socket;
+void dup_n(int socket)
 {
     int	i;
 #if 0
@@ -99,8 +97,7 @@ void dup_n(socket)
 
 /**********************************************************************/
 
-int get_port(ss)
-struct sockaddr_storage *ss;
+int get_port(struct sockaddr_storage *ss)
 /* Extract port number. Return value in host byte order. */
 {
   return ntohs((ss->ss_family == AF_INET6)
@@ -108,9 +105,7 @@ struct sockaddr_storage *ss;
 		: ((struct sockaddr_in *) ss)->sin_port);
 } /* get_port(struct sockaddr_storage *) */
 
-void set_port(ss, port)
-struct sockaddr_storage *ss;
-int port;
+void set_port(struct sockaddr_storage *ss, int port)
 /* Set port number. Input value in host byte order. */
 {
   switch (ss->ss_family) {
@@ -123,8 +118,7 @@ int port;
   }
 } /* set_port(struct sockaddr_storage *, short int) */
 
-int name_to_inet_port(portname)
-char *portname;
+int name_to_inet_port(char *portname)
 /* This procedure converts a character string to a port number.  It looks
    up the service by name and if there is none, then it converts the string
    to a number with sscanf. Return value in host byte order! */
@@ -152,9 +146,7 @@ char *portname;
 }
 
 struct sockaddr_storage ** /* addr_array */
-convert_hostname(name, count_ret)
-    char	*name;
-    int		*count_ret;
+convert_hostname(char *name, int *count_ret)
 {
   //struct hostent	*hp;
   struct addrinfo hints, *ai, *aiptr;
@@ -247,9 +239,7 @@ convert_hostname(name, count_ret)
 
 
 /* print an internet host address prettily */
-void printhost(fp, addr)
-     FILE	*fp;
-     struct sockaddr	*addr;
+void printhost(FILE *fp, struct sockaddr *addr)
 {
   int rc;
   char hostip[INET6_ADDRSTRLEN];
@@ -265,8 +255,7 @@ extern char *sys_errlist[];
 extern int sys_nerr;
 
 char *
-strerror(num)
-     int num;
+strerror(int num)
 {
   static char ebuf[40];		/* overflow this, baby */
   
--- a/hose.c
+++ b/hose.c
@@ -88,17 +88,14 @@ char	*localaddr=NULL;	/* local internet
 extern int	errno;
 
 
-int name_to_inet_port();
+extern int name_to_inet_port(char *);
 
 void usage () {
   fprintf(stderr,"Usage : %s <hostname> <port> (--in|--out|--err|--fd N|--slave|--netslave|--netslave1|--netslave2)+ [--verb(|ose)] [--unix] [--localport <port>] [--localhost <inet-addr>] [--retry n] [--delay n] [--shutdown [r|w][a]] [--noreuseaddr] -[i][o][e][#3[,4[,5...]]][s][v][q][u] [-p <local port>] [-h <local host>] <command> [ args ... ]\n",progname);
 }
 
 
-int setup_socket(hostname,portname, reuseaddr)
-char	*hostname;
-char	*portname;
-int	reuseaddr;
+int setup_socket(char *hostname, char *portname, int reuseaddr)
 
 {
   int	sock = -1;
@@ -227,9 +224,7 @@ int	reuseaddr;
    copy bytes from stdin to the socket and
    copy bytes from the socket to stdout.
    */
-void copyio(sock, aggressive_close)
-    int	sock;
-    int	aggressive_close;
+void copyio(int sock, int aggressive_close)
 {
     fd_set	readfds, writefds;
 #define BSIZE	4096
@@ -348,7 +343,7 @@ void copyio(sock, aggressive_close)
     exit(exitval);
 }
 
-void endjam()
+void endjam(int)
 {
   doflags &= ~DOJAM;
 }
@@ -385,8 +380,7 @@ void flag_err()
 	how_shutdown = 0;
 }
 
-int flag_scan_comma_fds(s)
-    char *s;
+int flag_scan_comma_fds(char *s)
 {
     int	rval=0;
     while (1) {
@@ -413,9 +407,7 @@ int flag_scan_comma_fds(s)
 /**********************************************************************/
 
 
-int main (argc,argv)
-     int argc;
-     char ** argv;
+int main (int argc, char **argv)
      
 {
   int	sock,i;
--- a/timelimit.c
+++ b/timelimit.c
@@ -41,8 +41,7 @@ char *childprogname=0;
 
 int deadchild = 0;
 
-void notice_child()
-
+void notice_child(int)
 {
     deadchild = 1;
 }
@@ -87,9 +86,7 @@ void kill_child(childpid)
     /* it better be dead now */
 }
 
-int main (argc,argv)
-     int argc;
-     char ** argv;
+int main (int argc, char **argv)
      
 {
     int	childpid, timelimit;
--- a/faucet.c
+++ b/faucet.c
@@ -90,7 +90,7 @@ void usage () {
   fprintf(stderr,"Usage : %s <port> (--in|--out|--err|--fd N)+ [--once] [--verb(|ose)] [--quiet] [--unix] [--foreignport <port>] [--foreignhost <inet-addr>] [--localhost <inet-addr>] [--daemon] [--serial] [--shutdown (r|w)] [--pidfile fname] [--noreuseaddr] [--backlog n] -[i][o][e][#3[,4[,5...]]][v][1][q][u][d][s] [-p <foreign port>] [-h <foreign host>] [-H <local host>] command args\n", progname);
 }
 
-void nice_shutdown()
+void nice_shutdown(int)
 /* This procedure gets called when we are killed with one of the reasonable
    signals (TERM, HUP, that kind of thing).  The main while loop then
    terminates and we get a chance to clean up. */
@@ -151,7 +151,7 @@ int	reuseaddr;
 }
 
 
-void waitonchild()
+void waitonchild(int)
 
 {
   int	status;
@@ -287,9 +287,7 @@ int flag_scan_comma_fds(s)
 /**********************************************************************/
 
 
-int main (argc,argv)
-int argc;
-char ** argv;
+int main (int argc, char **argv)
 
 {
   int	rval, i;
--- a/encapsulate.c
+++ b/encapsulate.c
@@ -1274,7 +1274,7 @@ static void main_io_loop(sock_fd)
 
 static int	childpid = -1;
 
-static void waitonchild()
+static void waitonchild(int)
 {
     /* got a SIGCHILD.
        It must be that: */
