Dear maintainer of netdiag,
I tried to fix the build failures introduced by the recently by-default
enabled compile flag -Werror=implicit-function-declaration.
All build errors inside the statnet sub project could be fixed by the
attached patch statnet_fix_implicit_function_declarations.patch,
including the implicit declaration of function `atoi`.
Unfortunately the build fails in the netwatch sub project too. Initial
attempts to fix that can be found in the attached patch
netwatch_fix_implicit_declarations.patch. However, for the implicitly
declared function `uthread_wait` I have no clue what it refers to. So, I
am stuck with the following build failure now:
make[1]: Entering directory
'/home/micha/src/netdiag/pkg.git/netwatch-1.3.1-2'
x86_64-linux-gnu-gcc -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2
-Werror=implicit-function-declaration
-ffile-prefix-map=/home/micha/src/netdiag/pkg.git/netwatch-1.3.1-2=.
-fstack-protector-strong -fstack-clash-protection -Wformat
-Werror=format-security -fcf-protection -ggdb -O0 -Wl,-z,relro
-Wl,-z,now -c dispdata.c
dispdata.c: In function 'dispdata':
dispdata.c:740:7: error: implicit declaration of function
'uthread_wait'; did you mean 'pthread_exit'?
[-Werror=implicit-function-declaration]
740 | uthread_wait(1000);
| ^~~~~~~~~~~~
| pthread_exit
dispdata.c:1357:48: warning: '%s' directive writing up to 511 bytes into
a region of size 509 [-Wformat-overflow=]
1357 | sprintf (&status_lines[3][3], "%s", ttt);
| ^~ ~~~
dispdata.c:1357:17: note: 'sprintf' output between 1 and 512 bytes into
a destination of size 509
1357 | sprintf (&status_lines[3][3], "%s", ttt);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [Makefile:40: dispdata.o] Error 1
make[1]: Leaving directory
'/home/micha/src/netdiag/pkg.git/netwatch-1.3.1-2'
make: *** [debian/rules:36: build-stamp] Error 2
dpkg-buildpackage: error: debian/rules build subprocess returned exit
status 2
A solution could be to selectively disable the
-Werror=implicit-function-declaration option again, but having seen this
error I don't feel comfortable moving forward in that direction.
I'll stop here, sharing the changes for how far I got already in the
hope it is useful to any more skilled or more patient developer.
Kind regards,
Micha
Author: Micha Lenk <mi...@debian.org>
diff --git a/statnet-3.8/getservent.c b/statnet-3.8/getservent.c
index 1ee6e5e..d99874b 100644
--- a/statnet-3.8/getservent.c
+++ b/statnet-3.8/getservent.c
@@ -42,6 +42,8 @@
static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <stdlib.h>
+
#include "inetprivate.h"
#define MAXALIASES 35
diff --git a/statnet-3.8/itstime.c b/statnet-3.8/itstime.c
index 9cace01..ca8ecd5 100644
--- a/statnet-3.8/itstime.c
+++ b/statnet-3.8/itstime.c
@@ -8,6 +8,7 @@
#include "stat.h"
#include <errno.h>
#include <signal.h>
+#include <unistd.h>
extern struct StatMemStruct *StatMem; /* pointer to shared memory segment */
diff --git a/statnet-3.8/stat.h b/statnet-3.8/stat.h
index 6686048..19bd2f7 100644
--- a/statnet-3.8/stat.h
+++ b/statnet-3.8/stat.h
@@ -40,6 +40,7 @@
#define SN_PROT_PPP 163 /* Pseudo protocol for PPP */
#define SN_PROT_LOOP 164 /* Pseudo protocol for Loopback */
+#include <ncurses.h>
#include <sys/types.h>
#include <netdb.h>
@@ -197,9 +198,7 @@ void set_null ( struct StatMemStruct *StatMem );
void services ();
void stat_delta ( struct StatMemStruct *New, struct StatMemStruct *Prev, struct StatMemStruct *Delta );
void usage (char *arg);
-#ifdef WINDOW
-void win_show_stat( WINDOW *win, int X, int Y, int noframes, struct Tally *Now_ts, struct Tally *Prev_ts, struct Tally *Delta_ts, short rewrite_labels, short *update_labels, void *show_labels );
-#endif
+void win_show_stat( WINDOW *win, int X, int Y, int noframes, struct Tally *Now_ts, struct Tally *Prev_ts, struct Tally *Delta_ts, short rewrite_labels, short *update_labels, void *show_labels() );
void tally_delta ( struct Tally *New_t,
struct Tally *Prev_t,
@@ -226,10 +225,9 @@ void tally_ntoh ( int bytecode,
struct Tally *New_t,
struct Tally *Prev_t );
-#ifdef WINDOW
void tally_label ( struct Tally *Now_ts, WINDOW *win, int width, int height );
-#endif
+int tally (int type_wanted, struct Tally *tally);
/* Now some redefinitions of <netdb.h> stuff. With the Berkeley notice... */
diff --git a/statnet-3.8/win_show_stat.c b/statnet-3.8/win_show_stat.c
index b7981b5..041a23c 100644
--- a/statnet-3.8/win_show_stat.c
+++ b/statnet-3.8/win_show_stat.c
@@ -4,6 +4,7 @@
/* 05FEB98: Scot E. Wilcoxon (sewi...@fieldday.mn.org) */
#include <values.h>
+#include <ncurses.h>
#include "stat.h"
#include "curs.h"
Author: Micha Lenk <mi...@debian.org>
diff --git a/netwatch-1.3.1-2/netwatch.h b/netwatch-1.3.1-2/netwatch.h
index c2fd4b7..7d46b3a 100644
--- a/netwatch-1.3.1-2/netwatch.h
+++ b/netwatch-1.3.1-2/netwatch.h
@@ -214,10 +214,12 @@ EXTERN_DEF struct port_info *tcp_port_types[TCPHASH];
#define UDPHASH 1786
EXTERN_DEF struct port_info *udp_port_types[UDPHASH];
+int dokeyin (int force);
int hashport( int port, int hash);
void initlist(struct port_info *first[], int hash);
char *searchlist(struct port_info *first[], int port, int hash);
char *servicenm( char *s, int port);
+void setuphelp ();