summaryrefslogtreecommitdiff
path: root/archivers/gsharutils/patches/patch-ai
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/gsharutils/patches/patch-ai')
-rw-r--r--archivers/gsharutils/patches/patch-ai46
1 files changed, 46 insertions, 0 deletions
diff --git a/archivers/gsharutils/patches/patch-ai b/archivers/gsharutils/patches/patch-ai
new file mode 100644
index 00000000000..9c434355a7e
--- /dev/null
+++ b/archivers/gsharutils/patches/patch-ai
@@ -0,0 +1,46 @@
+$NetBSD: patch-ai,v 1.3 2005/03/31 14:17:05 salo Exp $
+
+--- src/uudecode.c.orig 1995-12-02 04:14:14.000000000 +0100
++++ src/uudecode.c 2005-03-31 15:51:27.000000000 +0200
+@@ -81,6 +81,9 @@
+ /* Single character decode. */
+ #define DEC(Char) (((Char) - ' ') & 077)
+
++#if !defined S_ISLNK && defined S_IFLNK
++# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
++#endif
+
+ static int
+ read_stduu (inname)
+@@ -279,6 +282,7 @@
+ char buf[2 * BUFSIZ];
+ char *outname;
+ int do_base64 = 0;
++ struct stat attr;
+
+ /* Search for header line. */
+
+@@ -337,6 +341,23 @@
+ }
+ }
+
++ /* Check out file if it exists */
++ if (strcmp (outname, "/dev/stdout") != 0 && strcmp (outname, "-") != 0
++ && !access(outname, F_OK)) {
++ if (lstat(outname, &attr) == -1) {
++ error (0, errno, _("cannot access %s"), outname);
++ return 1;
++ }
++ if (S_ISFIFO(attr.st_mode)){
++ error (0, errno, _("denied writing FIFO (%s)"), outname);
++ return 1;
++ }
++ if (S_ISLNK(attr.st_mode)) {
++ error (0, errno, _("not following symlink (%s)"), outname);
++ return 1;
++ }
++ }
++
+ /* Create output file and set mode. */
+
+ if (strcmp (outname, "/dev/stdout") != 0 && strcmp (outname, "-") != 0