pkgsrc/archivers/afio/patches/patch-ab
dholland 5d6b1a5dd0 Fix broken Solaris build by not using sys_errlist.
Clean up other problems revealed by gcc -Wall:
   - pass (char *)NULL, not 0, as the last arg of execlp, to avoid
     crashes on LP64 platforms;
   - use signal.h, not sys/signal.h;
   - use utime(3) correctly;
   - use W* macros and sys/wait.h instead of hardcoding bit patterns.

Note in the DESCR that the package has been patched, as the license
might be construed to require this.

PKGREVISION -> 2.
2012-06-23 18:02:15 +00:00

45 lines
1.3 KiB
Text

$NetBSD: patch-ab,v 1.3 2012/06/23 18:02:15 dholland 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 2003-06-24 21:32:20.000000000 +0000
+++ compfile.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <errno.h>
+#include <limits.h>
#include <unistd.h>
#include <string.h>
@@ -179,7 +180,7 @@ int setupgzip(char *name)
if (open (name, O_RDONLY) >= 0)
{
if(! compressargs)
- execlp (compressprog, compressprog, "-c", farg, 0);
+ execlp (compressprog, compressprog, "-c", farg, (char *)NULL);
else
execvp (compressprog, compress_arg_list);
}
@@ -210,7 +211,7 @@ void waitforgzip()
* version;
*/
-#if ( defined(sun) && defined(__svr4__) )
+#if ( defined(__sun) && defined(__SVR4) )
#include <dirent.h>
#else
#include <sys/dir.h>
@@ -283,7 +284,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)