$NetBSD: patch-ag,v 1.3 2005/12/19 14:34:33 joerg Exp $

--- src/getsdir.c.orig	2005-12-19 14:23:45.000000000 +0000
+++ src/getsdir.c
@@ -207,9 +207,14 @@ int *len;
 		    int l;
 
 		    /* copy the filename */
+#ifdef NAME_MAX
+		    strncpy(datb_cur->data[datb_cur->cnt].fname,
+		            dp->d_name, NAME_MAX);
+#else
 		    strncpy(datb_cur->data[datb_cur->cnt].fname,
 			    dp->d_name,
 			    MAXNAMLEN);
+#endif
 
 	            /* get information about the directory entry */
 	            snprintf(fpath, sizeof(fpath), "%s/%s", dirpath, dp->d_name);
