$NetBSD: patch-ab,v 1.4 2015/02/15 14:45:48 ryoon Exp $

- Use NAME_MAX if available rather than relying on MAXNAMLEN.
- Fix Solaris preprocessor symbols.
- Fix bad calls to execlp() that break on 64-bit platforms.

--- compfile.c.orig	2012-02-05 13:45:01.000000000 +0000
+++ compfile.c
@@ -2,6 +2,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <limits.h>
 #include <unistd.h>
 #include <string.h>
 
@@ -211,7 +212,7 @@ void waitforgzip()
  * version;
  */
 
-#if ( defined(sun) && defined(__svr4__) ) || defined(__CYGWIN32__)
+#if ( defined(__sun) && defined(__svr4__) ) || defined(__CYGWIN32__)
 #include <dirent.h>
 #else
 #include <sys/dir.h>
@@ -284,7 +285,9 @@ compressfile (int *fdp, char *name, reg 
       tmpcomp++;
     else
       tmpcomp = name;
-#ifdef MAXNAMLEN	   /* BSD otherwise should be sysV (FFS on sysV?) */
+#if defined(NAME_MAX)
+    if (strlen (tmpcomp) + 2 > NAME_MAX)
+#elif defined(MAXNAMLEN)  /* BSD otherwise should be sysV (FFS on sysV?) */
     if (strlen (tmpcomp) + 2 > MAXNAMLEN)
 #else
     if (strlen (tmpcomp) + 2 > DIRSIZ)
