$NetBSD: patch-ab,v 1.12 2009/06/09 13:57:56 taca Exp $

--- bin/psorder/psorder.c.orig	2009-03-29 16:23:21.000000000 +0900
+++ bin/psorder/psorder.c
@@ -35,6 +35,7 @@
 #include <sys/uio.h>
 #include <sys/file.h>
 #include <ctype.h>
+#include <limits.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif /* HAVE_FCNTL_H */
@@ -102,7 +103,11 @@ psorder( path )
 {
     int			tempfd;
     int			inputfd;
+#if defined(NAME_MAX)
+    char		tempfile[NAME_MAX];
+#else
     char		tempfile[MAXNAMLEN];
+#endif
 
     filesetup( path, &inputfd, tempfile, &tempfd );
     readps( inputfd, tempfd, tempfile );
@@ -151,7 +156,11 @@ filesetup( inputfile, infd, tfile, tfd )
 	make temporary file
  */
 
-    strncpy( tfile, template, MAXNAMLEN );
+#if defined(NAME_MAX)
+    (void *)strncpy( tfile, template, NAME_MAX );
+#else
+    (void *)strncpy( tfile, template, MAXNAMLEN );
+#endif
     if (( *tfd = mkstemp( tfile )) == -1 ) {
 	fprintf( stderr, "can't create temporary file %s\n", tfile );
 	filecleanup( -1, -1, "" );
