Files
pkgsrc-ng/archivers/afio/patches/patch-ac
2016-01-21 23:40:00 +01:00

180 lines
4.7 KiB
Plaintext

$NetBSD: patch-ac,v 1.3 2015/02/15 14:45:48 ryoon Exp $
- 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 2012-02-05 13:25:57.000000000 +0000
+++ afio.c
@@ -166,7 +166,7 @@ static char *ident = "$Header: /u/buhrt/
#include <stdio.h>
#include <errno.h>
-#ifdef sun
+#ifdef __sun
#include <sys/types.h>
#include <utime.h>
#include <signal.h>
@@ -202,30 +202,29 @@ extern char *sys_errlist[];
#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
#ifndef major
-#ifdef sun
+#if defined(sun) || defined(__INTERIX)
#include <sys/mkdev.h>
+# if !defined(makedev) && defined(mkdev)
+# define makedev(a,b) mkdev((a),(b))
+# endif
#else
#include <sys/sysmacros.h>
#endif
@@ -1140,7 +1139,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];
@@ -1148,7 +1147,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 */
@@ -1239,7 +1238,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];
@@ -1267,7 +1266,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);
@@ -1758,7 +1757,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];
@@ -1794,7 +1793,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
@@ -3580,7 +3579,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];
@@ -3750,7 +3749,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);
@@ -4251,7 +4250,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];
@@ -4267,7 +4266,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
@@ -4901,7 +4900,7 @@ xwait (pid, what, compstat2)
char *what;
int compstat2;
{
- reg int status;
+ int status;
reg Child *cp;
reg Child **acp;
auto char why[100];
@@ -4918,16 +4917,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);
}