pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/56757: net/nagios-plugin-dnsrbl fails to build on Solarish
>Number: 56757
>Category: pkg
>Synopsis: net/nagios-plugin-dnsrbl fails to build on Solarish
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 16 21:15:00 +0000 2022
>Originator: Claes Nästén
>Release: trunk 2022-03-13
>Organization:
>Environment:
SunOS 5.10 sun4v sparc SUNW,SPARC-Enterprise-T2000
>Description:
net/nagios-plugins-dnsrbl fails to build on Solarish, for me on Solaris 10 but is also failing on SmartOS bulktracker.
gcc -pipe -fno-aggressive-loop-optimizations -pipe -fno-aggressive-loop-optimizations -D_FORTIFY_SOURCE=2 -c check_dnsrbl.c
check_dnsrbl.c:113:15: error: 'MAXHOSTNAMELEN' undeclared here (not in a function); did you mean 'MAXLINKNAMELEN'?
113 | char al_addr[MAXHOSTNAMELEN + 1];
| ^~~~~~~~~~~~~~
| MAXLINKNAMELEN
check_dnsrbl.c: In function 'load_dnsrbl':
check_dnsrbl.c:339:19: warning: implicit declaration of function 'fgetln'; did you mean 'fgets'? [-Wimplicit-function-declaration]
339 | for (lcount = 0; fgetln(f, &len) != NULL; lcount++);
| ^~~~~~
| fgets
check_dnsrbl.c:339:35: warning: comparison between pointer and integer
339 | for (lcount = 0; fgetln(f, &len) != NULL; lcount++);
| ^~
check_dnsrbl.c:354:13: warning: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
354 | if ((line = fgetln(f, &len)) == NULL)
| ^
*** [check_dnsrbl.o] Error code 1
>How-To-Repeat:
Build net/nagios-plugins-dnsrbl on Solarish.
>Fix:
diff --git a/net/nagios-plugin-dnsrbl/Makefile b/net/nagios-plugin-dnsrbl/Makefile
index 4cf96e87c74..7aed5ea8961 100644
--- a/net/nagios-plugin-dnsrbl/Makefile
+++ b/net/nagios-plugin-dnsrbl/Makefile
@@ -12,6 +12,8 @@ HOMEPAGE= https://ftp.espci.fr/pub/nagios-local/
COMMENT= DNSRBL monitoring plugin for Nagios
LICENSE= modified-bsd
+LDFLAGS.SunOS+= -lsocket -lnsl -lresolv
+
INSTALLATION_DIRS+= libexec/nagios
do-install:
diff --git a/net/nagios-plugin-dnsrbl/patches/patch-Makefile b/net/nagios-plugin-dnsrbl/patches/patch-Makefile
new file mode 100644
index 00000000000..cdd6ea4fbc4
--- /dev/null
+++ b/net/nagios-plugin-dnsrbl/patches/patch-Makefile
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- Makefile.orig 2022-03-16 20:36:15.681345846 +0000
++++ Makefile
+@@ -1,10 +1,10 @@
+ CFLAGS?=-O2
+-LIBS?= -lpthread
++LDFLAGS?=-lpthread
+
+ all: check_dnsrbl
+
+ check_dnsrbl: check_dnsrbl.o
+- $(CC) $(LIBS) -o check_dnsrbl check_dnsrbl.o
++ $(CC) $(LDFLAGS) -o check_dnsrbl check_dnsrbl.o
+
+ clean:
+ rm -f *.o *.core check_dnsrbl
diff --git a/net/nagios-plugin-dnsrbl/patches/patch-check__dnsrbl.c b/net/nagios-plugin-dnsrbl/patches/patch-check__dnsrbl.c
new file mode 100644
index 00000000000..ae053363b9f
--- /dev/null
+++ b/net/nagios-plugin-dnsrbl/patches/patch-check__dnsrbl.c
@@ -0,0 +1,54 @@
+$NetBSD$
+
+Portability fixes, fallback MAXHOSTNAMELEN define and use getline instead of
+fgetln.
+
+--- check_dnsrbl.c.orig 2022-03-16 20:27:43.357213335 +0000
++++ check_dnsrbl.c
+@@ -57,6 +57,10 @@
+ #define STATE_UNKNOWN 3
+ #endif
+
++#ifndef MAXHOSTNAMELEN
++#define MAXHOSTNAMELEN 256
++#endif
++
+ #define DEFAULT_TIMEOUT 120
+
+ struct dnsrbl {
+@@ -328,15 +332,15 @@ load_dnsrbl(file)
+ char *file;
+ {
+ FILE *f;
+- char *line;
+- size_t len;
++ char *line = NULL;
++ size_t len = 0;
+ int lcount;
+ struct dnsrbl *d;
+
+ if ((f = fopen(file, "r")) == NULL)
+ panic("cannot open dnsrbl file");
+
+- for (lcount = 0; fgetln(f, &len) != NULL; lcount++);
++ for (lcount = 0; getline(&line, &len, f) != -1; lcount++);
+
+ if (verbose)
+ printf("dnsrbl file \"%s\" has %d lines\n", file, lcount);
+@@ -351,7 +355,7 @@ load_dnsrbl(file)
+
+ while(lcount-- > 0) {
+ const char *s = " \t\n";
+- if ((line = fgetln(f, &len)) == NULL)
++ if (getline(&line, &len, f) == -1)
+ panic( "unexpected empty line in dnsrbl");
+
+ if ((d[lcount].d_domain = strdup(strtok(line, s))) == NULL)
+@@ -365,6 +369,7 @@ load_dnsrbl(file)
+ file, d[lcount].d_domain, d[lcount].d_positive);
+ }
+
++ free(line);
+ (void)fclose(f);
+
+ return d;
Home |
Main Index |
Thread Index |
Old Index