From: Matt Zagrabelny Date: Thu, 23 Jul 2020 14:44:50 -0500 Subject: Fix FTBFS for GCC-10, Closes: #957072 Migrate global variables from header to C file. GCC 10 is complaining about multiple definitions... cc -Wl,-z,relro -Wl,-z,now -o cdpr cdpr.o cdprs.o conffile.o -lpcap /usr/bin/ld: cdprs.o:./cdpr.h:51: multiple definition of `handle'; cdpr.o:./cdpr.h:51: first defined here /usr/bin/ld: cdprs.o:./cdpr.h:50: multiple definition of `cdprs'; cdpr.o:./cdpr.h:50: first defined here /usr/bin/ld: cdprs.o:./cdpr.h:49: multiple definition of `timeout'; cdpr.o:./cdpr.h:49: first defined here /usr/bin/ld: conffile.o:./cdpr.h:51: multiple definition of `handle'; cdpr.o:./cdpr.h:51: first defined here /usr/bin/ld: conffile.o:./cdpr.h:50: multiple definition of `cdprs'; cdpr.o:./cdpr.h:50: first defined here /usr/bin/ld: conffile.o:./cdpr.h:49: multiple definition of `timeout'; cdpr.o:./cdpr.h:49: first defined here From evaluating the source code, the global variables declared in the header are not used anywhere but in cdpr.c, thus we can move those variable declarations to the source file (cdpr.c) to fix the error. --- cdpr.c | 7 +++++++ cdpr.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cdpr.c b/cdpr.c index 02785fe..05b0006 100644 --- a/cdpr.c +++ b/cdpr.c @@ -87,6 +87,13 @@ #include "cdpr.h" #include "cdp.h" +/* +** Global variables +*/ +int timeout; +int cdprs; +pcap_t *handle; + void dump_ip (const u_char *ip) { diff --git a/cdpr.h b/cdpr.h index 93d1b25..8b184e9 100644 --- a/cdpr.h +++ b/cdpr.h @@ -43,13 +43,6 @@ struct singleton const u_char *pkt; }; -/* -** Global variables -*/ -int timeout; -int cdprs; -pcap_t *handle; - /* ** Function Prototypes */