diff options
author | dholland <dholland@pkgsrc.org> | 2012-06-23 18:02:15 +0000 |
---|---|---|
committer | dholland <dholland@pkgsrc.org> | 2012-06-23 18:02:15 +0000 |
commit | f927f1e0728a16f7672eacdaac1f905778dc9f5d (patch) | |
tree | eb4507c7c2a4857a3b7e8fff4793a34fc9aee7a8 | |
parent | 9fa823ce144ada61060874708d309b7d28f8682c (diff) | |
download | pkgsrc-f927f1e0728a16f7672eacdaac1f905778dc9f5d.tar.gz |
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.
-rw-r--r-- | archivers/afio/DESCR | 3 | ||||
-rw-r--r-- | archivers/afio/Makefile | 4 | ||||
-rw-r--r-- | archivers/afio/distinfo | 6 | ||||
-rw-r--r-- | archivers/afio/patches/patch-ab | 15 | ||||
-rw-r--r-- | archivers/afio/patches/patch-ac | 229 |
5 files changed, 238 insertions, 19 deletions
diff --git a/archivers/afio/DESCR b/archivers/afio/DESCR index b36756df70d..0a9ec8cc826 100644 --- a/archivers/afio/DESCR +++ b/archivers/afio/DESCR @@ -3,3 +3,6 @@ input data corruption. Supports multi-volume archives during interactive operation. Afio can make compressed archives that are much safer than compressed tar or cpio archives. Afio is best used as an `archive engine' in a backup script. + +The package's license may require formal disclosure that the software +has been patched. diff --git a/archivers/afio/Makefile b/archivers/afio/Makefile index 4a407f285db..3bbfd2b9167 100644 --- a/archivers/afio/Makefile +++ b/archivers/afio/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.10 2008/03/02 03:48:36 jlam Exp $ +# $NetBSD: Makefile,v 1.11 2012/06/23 18:02:15 dholland Exp $ DISTNAME= afio-2.5 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= archivers MASTER_SITES= http://www.ibiblio.org/pub/Linux/system/backup/ EXTRACT_SUFX= .tgz diff --git a/archivers/afio/distinfo b/archivers/afio/distinfo index e0418e04f98..d9ffd932c5d 100644 --- a/archivers/afio/distinfo +++ b/archivers/afio/distinfo @@ -1,8 +1,8 @@ -$NetBSD: distinfo,v 1.6 2005/10/03 11:15:55 joerg Exp $ +$NetBSD: distinfo,v 1.7 2012/06/23 18:02:15 dholland Exp $ SHA1 (afio-2.5.tgz) = 051765f209fded60f94944da8a76ae37c3423a23 RMD160 (afio-2.5.tgz) = 991bdb794ee8b4b7e6a737afa85009aae925699d Size (afio-2.5.tgz) = 179184 bytes SHA1 (patch-aa) = e35b47c2f10a6f80d8446e4c22a7a023dae55933 -SHA1 (patch-ab) = 8d71a26fb6e68462d5a1789a381d485bf63e638b -SHA1 (patch-ac) = 9c631e4ebf9b6aafd9a72461b285dfcae7a25048 +SHA1 (patch-ab) = 746c0eaf036cba60fb48e798175e055df6addd77 +SHA1 (patch-ac) = 99378318e898429153352a2d9b47008f419865af diff --git a/archivers/afio/patches/patch-ab b/archivers/afio/patches/patch-ab index 957e49b7624..e4cd58bdbc8 100644 --- a/archivers/afio/patches/patch-ab +++ b/archivers/afio/patches/patch-ab @@ -1,4 +1,8 @@ -$NetBSD: patch-ab,v 1.2 2005/10/03 11:15:55 joerg Exp $ +$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 @@ -10,6 +14,15 @@ $NetBSD: patch-ab,v 1.2 2005/10/03 11:15:55 joerg Exp $ #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; */ diff --git a/archivers/afio/patches/patch-ac b/archivers/afio/patches/patch-ac index 97563cdbc6d..51196a4ba15 100644 --- a/archivers/afio/patches/patch-ac +++ b/archivers/afio/patches/patch-ac @@ -1,10 +1,68 @@ -$NetBSD: patch-ac,v 1.1 2005/01/19 17:08:09 tv Exp $ +$NetBSD: patch-ac,v 1.2 2012/06/23 18:02:15 dholland Exp $ ---- afio.c.orig 2005-01-19 11:49:18.000000000 -0500 +- Use standard headers. +- Use strerror, not sys_errlist and sys_nerr. +- Use POSIX utime() interface, not half-baked version. +- Use W* macros from sys/wait.h instead of hard-coding the historic + bit patterns. +- Build fix for makedev() on Solaris and Interix. +- Fix bad calls to execlp() that break on 64-bit platforms. + +--- afio.c.orig 2003-12-20 22:16:13.000000000 +0000 +++ afio.c -@@ -210,8 +210,11 @@ extern char *sys_errlist[]; +@@ -166,52 +166,40 @@ static char *ident = "$Header: /u/buhrt/ + #include <signal.h> + #include <strings.h> + #include <sys/wait.h> +-#define linux_tstamp 1 +-/* fix SunOS errno.h not declaring what the manpage says it declares +- bogosity. */ +- extern int sys_nerr; +- extern char *sys_errlist[]; +-#endif +- +-#ifdef hpux +- /* Fix that HPUX dosent have sys_nerr or sys_errlist +- Added by Daniel Andersson, daniel.andersson@sto.sema.se +- */ +-extern int sys_nerr; +-extern char *sys_errlist[]; + #endif + + #include <unistd.h> + #include <string.h> + #include <stdlib.h> +-#include <sys/signal.h> ++#include <signal.h> + #include <sys/types.h> + #include <sys/ioctl.h> + #include <sys/stat.h> ++#include <sys/wait.h> + #include <pwd.h> + #include <grp.h> ++#include <utime.h> + #include "patchlevel.h" + + #ifdef linux +- +-#define linux_tstamp 1 +- +-#include <utime.h> +-#include <sys/wait.h> +- + /* for flushing floppy cache */ + #include <linux/fd.h> + #endif + + /* compatibility fixes for IRIX native c compiler. */ + #ifdef irix_cc_compatibility +-#define linux_tstamp 1 + #include <strings.h> #endif ++/* nothing should need this */ ++/*#define broken_utime*/ ++ #ifndef major -#ifdef sun +#if defined(sun) || defined(__INTERIX) @@ -15,20 +73,165 @@ $NetBSD: patch-ac,v 1.1 2005/01/19 17:08:09 tv Exp $ #else #include <sys/sysmacros.h> #endif -@@ -4354,12 +4357,16 @@ fswrite (fd, buf, len) +@@ -1122,7 +1110,7 @@ savedirstamp (char *name, time_t mtime) + STATIC void + restoredirstamps (void) + { +-#ifdef linux_tstamp ++#ifndef broken_utime + auto struct utimbuf tstamp; + #else + auto time_t tstamp[2]; +@@ -1130,7 +1118,7 @@ restoredirstamps (void) + Dir *DirP_forw; + while(DirP!=NULL) + { +-#ifdef linux_tstamp ++#ifndef broken_utime + tstamp.actime = DirP->d_mtime; + tstamp.modtime = DirP->d_mtime; + /* no error code checking on purpose */ +@@ -1212,7 +1200,7 @@ readcheck (av) + auto char name[PATHSIZE]; + auto char local[PATHSIZE]; + int sel, res; +-#ifdef linux_tstamp ++#ifndef broken_utime + auto struct utimbuf tstamp; + #else + auto time_t tstamp[2]; +@@ -1241,7 +1229,7 @@ readcheck (av) + if(aflag && atime_sb_valid && ((sb.sb_mode & S_IFMT)==S_IFREG)) + { + /* reset access time, this distroys the ctime btw. */ +-#ifdef linux_tstamp ++#ifndef broken_utime + tstamp.actime = atime_sb.sb_atime; + tstamp.modtime = atime_sb.sb_mtime; + VOID utime (name, &tstamp); +@@ -1585,7 +1573,7 @@ incheckdata (int fd, off_t size, char *n + if(compressargs) + execvp (compressprog, compress_arg_list); + else +- execlp (compressprog, compressprog, "-d", "-c", 0); ++ execlp (compressprog, compressprog, "-d", "-c", (char *)NULL); + fprintf (stderr, "Could not uncompress, errno %d\n", errno); + exit(1); + break; +@@ -1696,7 +1684,7 @@ inentry (name, asb) + reg Link *linkp; + reg int ifd; + reg int ofd; +-#ifdef linux_tstamp ++#ifndef broken_utime + auto struct utimbuf tstamp; + #else + auto time_t tstamp[2]; +@@ -1729,7 +1717,7 @@ inentry (name, asb) + /* Cannot set utime on symlink (at least not under Linux) */ + if((asb->sb_mode & S_IFMT) != S_IFLNK) + { +-#ifdef linux_tstamp ++#ifndef broken_utime + tstamp.actime = tstamp.modtime = mflag ? timenow : asb->sb_mtime; + VOID utime (name, &tstamp); + #else +@@ -3004,7 +2992,7 @@ opencontrolscript (char *name) + VOID dup (pfd[0]); + VOID close (pfd[0]); + +- execlp (controlscript, controlscript, label, 0); ++ execlp (controlscript, controlscript, label, (char *)NULL); + + warnarch("Problems running control script:",(off_t)0); + warn(controlscript,syserr()); +@@ -3266,7 +3254,7 @@ openotty (name, asb, linkp, ispass, dozf + if(compressargs) + execvp (compressprog, compress_arg_list); + else +- execlp (compressprog, compressprog, "-d", "-c", 0); ++ execlp (compressprog, compressprog, "-d", "-c", (char *)NULL); + fprintf (stderr, "Could not uncompress, errno %d\n", errno); + exit (1); + } +@@ -3493,7 +3481,7 @@ out (av) + auto char name[PATHSIZE]; + auto char fsname[PATHSIZE]; + auto int compression; +-#ifdef linux_tstamp ++#ifndef broken_utime + auto struct utimbuf tstamp; + #else + auto time_t tstamp[2]; +@@ -3638,7 +3626,7 @@ out (av) + if(aflag && *fsname && ((sb.sb_mode & S_IFMT)==S_IFREG)) + { + /* reset access time, this distroys the ctime btw. */ +-#ifdef linux_tstamp ++#ifndef broken_utime + tstamp.actime = sb.sb_atime; + tstamp.modtime = sb.sb_mtime; + VOID utime (fsname, &tstamp); +@@ -4133,7 +4121,7 @@ passitem (from, asb, ifd, dir) + { + reg int ofd; + +-#ifdef linux_tstamp ++#ifndef broken_utime + auto struct utimbuf tstamp; + #else + auto time_t tstamp[2]; +@@ -4149,7 +4137,7 @@ passitem (from, asb, ifd, dir) + continue; + if (ofd > 0) + passdata (from, ifd, to, ofd); +-#ifdef linux_tstamp ++#ifndef broken_utime + tstamp.actime = tstamp.modtime = mflag ? timenow : asb->sb_mtime; + VOID utime (to, &tstamp); + #else +@@ -4354,12 +4342,7 @@ fswrite (fd, buf, len) STATIC char * syserr () { -+#ifdef __INTERIX +- static char msg[40]; +- +- if (errno > 0 && errno < sys_nerr) +- return ((char *) sys_errlist[errno]); +- VOID sprintf (msg, "Unknown error (errno %d)", errno); +- return (msg); + return strerror(errno); -+#else - static char msg[40]; - - if (errno > 0 && errno < sys_nerr) - return ((char *) sys_errlist[errno]); - VOID sprintf (msg, "Unknown error (errno %d)", errno); - return (msg); -+#endif } /* +@@ -4765,7 +4748,7 @@ xwait (pid, what, compstat2) + char *what; + int compstat2; + { +- reg int status; ++ int status; + reg Child *cp; + reg Child **acp; + auto char why[100]; +@@ -4782,16 +4765,16 @@ xwait (pid, what, compstat2) + free ((char *) cp); + if (status == 0) + return (0); +- if (status & 0377) ++ if (WIFSIGNALED(status)) + VOID sprintf (why, "Killed by signal %d%s", +- status & 0177, status & 0200 ? " -- core dumped" : ""); ++ WTERMSIG(status), WCOREDUMP(status) ? " -- core dumped" : ""); + else +- VOID sprintf (why, "Exit %d", (status >> 8) & 0377); ++ VOID sprintf (why, "Exit %d", WEXITSTATUS(status)); + +- if ((!compstat2 && (((status >> 8) & 0377) != 2)) || compstat2) ++ if ((!compstat2 && (WEXITSTATUS(status) != 2)) || compstat2) + return (warn (what, why)); + else +- return ((status >> 8) & 0377); ++ return WEXITSTATUS(status); + } + + |