summaryrefslogtreecommitdiff
path: root/devel/cscope/patches
diff options
context:
space:
mode:
authorwiz <wiz>2004-12-17 22:29:06 +0000
committerwiz <wiz>2004-12-17 22:29:06 +0000
commit77640f4ccd33f621d1b34239449e951d9dcee5ab (patch)
tree179330c25f54d17c0504df8e673bd6abe1a98d6d /devel/cscope/patches
parent68881dc6e39d23c27dd427a78d8d136c579409d2 (diff)
downloadpkgsrc-77640f4ccd33f621d1b34239449e951d9dcee5ab.tar.gz
Apply patch from Debian package against CAN-2004-0996; based on patch
by Gerardo Di Giacomo. Bump PKGREVISION.
Diffstat (limited to 'devel/cscope/patches')
-rw-r--r--devel/cscope/patches/patch-af40
1 files changed, 40 insertions, 0 deletions
diff --git a/devel/cscope/patches/patch-af b/devel/cscope/patches/patch-af
new file mode 100644
index 00000000000..8440af11c61
--- /dev/null
+++ b/devel/cscope/patches/patch-af
@@ -0,0 +1,40 @@
+$NetBSD: patch-af,v 1.4 2004/12/17 22:29:06 wiz Exp $
+
+--- src/main.c.orig 2002-07-28 17:40:07.000000000 +0200
++++ src/main.c
+@@ -319,9 +319,32 @@ lastarg:
+ }
+
+ /* create the temporary file names */
+- pid = getpid();
+- (void) sprintf(temp1, "%s/cscope%d.1", tmpdir, pid);
+- (void) sprintf(temp2, "%s/cscope%d.2", tmpdir, pid);
++ do {
++ char *tempfile = tempnam(tmpdir, "cscope1");
++ if (!tempfile) {
++ fprintf (stderr, "Can't create tempfile\n");
++ exit(1);
++ }
++ if (strlen(tempfile) >= sizeof(temp1)) {
++ fprintf (stderr, "TMPDIR path is too long\n");
++ exit(1);
++ }
++ strncpy (temp1, tempfile, sizeof (temp1));
++ free (tempfile);
++ } while (open (temp1, O_CREAT|O_EXCL|O_WRONLY, S_IREAD|S_IWRITE) < 0);
++ do {
++ char *tempfile = tempnam(tmpdir, "cscope2");
++ if (!tempfile) {
++ fprintf (stderr, "Can't create tempfile\n");
++ exit(1);
++ }
++ if (strlen(tempfile) >= sizeof(temp2)) {
++ fprintf (stderr, "TMPDIR path is too long\n");
++ exit(1);
++ }
++ strncpy (temp2, tempfile, sizeof (temp2));
++ free (tempfile);
++ } while (open (temp2, O_CREAT|O_EXCL|O_WRONLY, S_IREAD|S_IWRITE) < 0);
+
+ /* if running in the foreground */
+ if (signal(SIGINT, SIG_IGN) != SIG_IGN) {