summaryrefslogtreecommitdiff
path: root/net/nfdump/patches/patch-af
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfdump/patches/patch-af')
-rw-r--r--net/nfdump/patches/patch-af52
1 files changed, 52 insertions, 0 deletions
diff --git a/net/nfdump/patches/patch-af b/net/nfdump/patches/patch-af
new file mode 100644
index 00000000000..c3d62e58a76
--- /dev/null
+++ b/net/nfdump/patches/patch-af
@@ -0,0 +1,52 @@
+$NetBSD: patch-af,v 1.1 2007/08/12 13:57:36 joerg Exp $
+
+--- sfcapd.c.orig 2007-08-12 13:30:13.000000000 +0000
++++ sfcapd.c
+@@ -60,6 +60,7 @@
+ #include <sys/mman.h>
+ #include <string.h>
+ #include <dirent.h>
++#include <limits.h>
+
+ #include "config.h"
+
+@@ -454,7 +455,11 @@ int main(int argc, char **argv) {
+
+ char *bindhost, *filter, *datadir, pidstr[32], *lauch_process;
+ char *userid, *groupid, *checkptr, *listenport, *mcastgroup;
+-char pidfile[MAXNAMLEN];
++#ifdef PATH_MAX
++char pidfile[PATH_MAX];
++#else
++char pidfile[MAXPATHLEN];
++#endif
+ struct stat fstat;
+ srecord_t *commbuff;
+ struct sigaction act;
+@@ -530,18 +535,20 @@ pid_t pid;
+ break;
+ case 'P':
+ if ( optarg[0] == '/' ) { // absolute path given
+- strncpy(pidfile, optarg, MAXNAMLEN-1);
++ strncpy(pidfile, optarg, sizeof(pidfile));
++ pidfile[sizeof(pidfile) - 1] = '\0'
+ } else { // path relative to current working directory
++#ifdef PATH_MAX
++ char tmp[PATH_MAX]
++#else
+ char tmp[MAXPATHLEN];
+- if ( !getcwd(tmp, MAXPATHLEN-1) ) {
++#endif
++ if ( !getcwd(tmp, sizeof(tmp)) ) {
+ fprintf(stderr, "Failed to get current working directory: %s\n", strerror(errno));
+ exit(255);
+ }
+- tmp[MAXPATHLEN-1] = 0;
+- snprintf(pidfile, MAXPATHLEN - 1 - strlen(tmp), "%s/%s", tmp, optarg);
++ snprintf(pidfile, sizeof(pidfile), "%s/%s", tmp, optarg);
+ }
+- // pidfile now absolute path
+- pidfile[MAXNAMLEN-1] = 0;
+ break;
+ case 'r':
+ report_sequence = 1;