diff options
author | Christian Weisgerber <naddy@FreeBSD.org> | 2005-10-14 12:25:57 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@FreeBSD.org> | 2005-10-14 12:25:57 +0000 |
commit | 2a4fabbee28525028812b46c5eea2496da345ea6 (patch) | |
tree | 98153ea4820a4117fba7b5698789b86b3e63067d /archivers/arc/files | |
parent | dd3d3c91a59f5843f930a053dd90aef95c3df4d6 (diff) | |
download | ports-2a4fabbee28525028812b46c5eea2496da345ea6.tar.gz ports-2a4fabbee28525028812b46c5eea2496da345ea6.zip |
Update to 5.21n. No user-visible changes.
The new upstream version now opens temporary files in a safe manner,
so our local patches for this are no longer needed.
Approved by: ache
Notes
Notes:
svn path=/head/; revision=145370
Diffstat (limited to 'archivers/arc/files')
-rw-r--r-- | archivers/arc/files/patch-ac | 70 | ||||
-rw-r--r-- | archivers/arc/files/patch-ad | 60 | ||||
-rw-r--r-- | archivers/arc/files/patch-ai | 6 | ||||
-rw-r--r-- | archivers/arc/files/patch-al | 14 |
4 files changed, 14 insertions, 136 deletions
diff --git a/archivers/arc/files/patch-ac b/archivers/arc/files/patch-ac deleted file mode 100644 index 87e6754e95f2..000000000000 --- a/archivers/arc/files/patch-ac +++ /dev/null @@ -1,70 +0,0 @@ ---- ./marc.c.orig Tue Apr 14 18:59:21 1992 -+++ ./marc.c Wed Aug 11 10:22:31 1999 -@@ -28,12 +28,17 @@ - #if UNIX - #include <sys/types.h> - #include <sys/stat.h> -+#include <errno.h> -+#include <unistd.h> -+#include <string.h> -+#include <err.h> - #endif - - #ifndef __STDC__ - char *calloc(), *malloc(), *realloc(); /* memory managers */ - #endif - VOID arcdie(); -+int move(),setstamp(); - static VOID expandlst(), merge(); - - FILE *src; /* source archive */ -@@ -50,7 +55,7 @@ - char *makefnam(); /* filename fixup routine */ - char *envfind(); - #if !_MTS -- char *arctemp2, *mktemp(); /* temp file stuff */ -+ char *arctemp2; /* temp file stuff */ - #endif - #if GEMDOS - VOID exitpause(); -@@ -114,8 +119,18 @@ - #endif - #if !MSDOS - { -- static char tempname[] = "AXXXXXX"; -- strcat(arctemp, mktemp(tempname)); -+ static char tempname[] = "AXXXXXX.arc"; -+ int fd=-1; -+ strcat(arctemp, tempname); -+ if((fd = mkstemps(arctemp,4)) == -1 || -+ (new = fdopen(fd, "w+")) == NULL) { -+ if (fd != -1) { -+ unlink(arctemp); -+ close(fd); -+ } -+ err(1, "can't create temp file %s", arctemp); -+ } -+ - } - #else - strcat(arctemp, "$ARCTEMP"); -@@ -148,8 +163,10 @@ - arc = fopen(arcname,OPEN_R); /* open the archives */ - if(!(src=fopen(srcname,OPEN_R))) - arcdie("Cannot read source archive %s",srcname); -+#if !defined(__OpenBSD__) && !defined(__FreeBSD__) /* this is insecure, see mkstemp(3) */ - if(!(new=fopen(newname,OPEN_W))) - arcdie("Cannot create new archive %s",newname); -+#endif - - if(!arc) - printf("Creating new archive %s\n",arcname); -@@ -283,7 +300,7 @@ - else return 0; /* or fake end of archive */ - } - --copyfile(f,hdr,ver) /* copy a file from an archive */ -+int copyfile(f,hdr,ver) /* copy a file from an archive */ - FILE *f; /* archive to copy from */ - struct heads *hdr; /* header data for file */ - int ver; /* header version */ diff --git a/archivers/arc/files/patch-ad b/archivers/arc/files/patch-ad index 36dc9639f290..63954d8d2317 100644 --- a/archivers/arc/files/patch-ad +++ b/archivers/arc/files/patch-ad @@ -1,58 +1,6 @@ ---- ./arc.c.orig Tue Apr 14 18:58:59 1992 -+++ ./arc.c Wed Aug 11 10:21:06 1999 -@@ -76,11 +76,14 @@ - #if UNIX - #include <sys/types.h> - #include <sys/stat.h> -+#include <unistd.h> - #endif - - #include <string.h> - #if BSD - #include <strings.h> -+#include <err.h> -+#include <errno.h> - #endif - - #if !__STDC__ -@@ -101,6 +104,7 @@ - static char **lst; /* files list */ - static int lnum; /* length of files list */ - -+int - main(num, arg) /* system entry point */ - int num; /* number of arguments */ - char *arg[]; /* pointers to arguments */ -@@ -110,7 +114,7 @@ - VOID upper();/* case conversion routine */ - char *envfind(); /* environment searcher */ - int n; /* index */ -- char *arctemp2, *mktemp(); -+ char *arctemp2; - #if GEMDOS - VOID exitpause(); - int append; -@@ -219,8 +223,17 @@ - #endif - #if !MSDOS - { -- static char tempname[] = "AXXXXXX"; -- strcat(arctemp, mktemp(tempname)); -+ static char tempname[] = "AXXXXXX.arc"; -+ int fd=-1; -+ strcat(arctemp, tempname); -+ if((fd = mkstemps(arctemp,4)) == -1 || -+ (new = fdopen(fd, "w+")) == NULL) { -+ if (fd != -1) { -+ unlink(arctemp); -+ close(fd); -+ } -+ err(1, "can't create temp file %s", arctemp); -+ } - } - #else - strcat(arctemp, "$ARCTEMP"); -@@ -276,7 +289,7 @@ +--- arc.c.orig Sun Oct 9 03:38:22 2005 ++++ arc.c Fri Oct 14 14:22:38 2005 +@@ -290,7 +290,7 @@ keepbak = 1; else if (*a == 'W') /* suppress warnings */ @@ -61,7 +9,7 @@ #if !DOS else if (*a == 'I') /* image mode, no ASCII/EBCDIC x-late */ image = !image; -@@ -401,7 +414,7 @@ +@@ -426,7 +426,7 @@ expandlst(n) /* expand an indirect reference */ int n; /* number of entry to expand */ { diff --git a/archivers/arc/files/patch-ai b/archivers/arc/files/patch-ai index c13db4acb537..eae8495ed002 100644 --- a/archivers/arc/files/patch-ai +++ b/archivers/arc/files/patch-ai @@ -1,12 +1,12 @@ ---- ./arcext.c.orig Tue Aug 10 23:03:25 1999 -+++ ./arcext.c Tue Aug 10 23:01:56 1999 +--- arcext.c.orig Sat Oct 8 22:24:37 2005 ++++ arcext.c Fri Oct 14 00:52:14 2005 @@ -143,7 +143,7 @@ if (note) printf("Extracting file: %s\n", fix); - if (warn && !overlay) { + if (arcwarn && !overlay) { - if (f = fopen(fix, "r")) { /* see if it exists */ + if ((f = fopen(fix, "r"))) { /* see if it exists */ fclose(f); printf("WARNING: File %s already exists!", fix); @@ -190,7 +190,7 @@ diff --git a/archivers/arc/files/patch-al b/archivers/arc/files/patch-al index 734b15f3f8d2..01fc04932fe9 100644 --- a/archivers/arc/files/patch-al +++ b/archivers/arc/files/patch-al @@ -1,6 +1,6 @@ ---- ./arcrun.c.orig Tue Aug 10 23:03:25 1999 -+++ ./arcrun.c Tue Aug 10 23:01:57 1999 -@@ -94,7 +94,7 @@ +--- arcrun.c.orig Sun Oct 9 03:38:22 2005 ++++ arcrun.c Fri Oct 14 00:53:57 2005 +@@ -98,7 +98,7 @@ strcpy(sys, buf); else { @@ -9,7 +9,7 @@ printf("File %s is not a .BAS, .BAT, .COM, or .EXE\n", hdr->name); nerrs++; -@@ -108,7 +108,7 @@ +@@ -112,7 +112,7 @@ && strcmp(i, ".TTP") && strcmp(i, ".TOS")) { @@ -18,16 +18,16 @@ printf("File %s is not a .PRG, .TOS, or .TTP\n", hdr->name); nerrs++; -@@ -118,7 +118,7 @@ +@@ -122,7 +122,7 @@ } #endif - if (warn) + if (arcwarn) - if (tmp = fopen(buf, "r")) + if ((tmp = fopen(buf, "r"))) arcdie("Temporary file %s already exists", buf); if (!(tmp = fopen(buf, OPEN_W))) -@@ -142,7 +142,7 @@ +@@ -148,7 +148,7 @@ #endif chdir(dir); free(dir); /* return to whence we started */ |