Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Sep 2002 10:06:50 -0700 (PDT)
From:      "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        kris@FreeBSD.org
Subject:   ports/42510: Fix build of news/knews on -current
Message-ID:  <200209071706.g87H6o2D022065@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help

>Number:         42510
>Category:       ports
>Synopsis:       Fix build of news/knews on -current
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 07 10:10:02 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Steven G. Kargl
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
APL/UW
>Environment:
System: FreeBSD troutmask.apl.washington.edu 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Wed Sep 4 12:10:46 PDT 2002 kargl@troutmask.apl.washington.edu:/usr/obj/usr/src/sys/TROUTMASK i386


	

>Description:

The news/knews port no longer builds because the visibility of
P_tmpdir in /usr/include/stdio.h has been changed.  From stdio.h
we have

/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
#if __XSI_VISIBLE
#define P_tmpdir        "/var/tmp/"
#endif

>How-To-Repeat:

cd /usr/ports/news/knews
make

>Fix:

Replace knews/files/patch-file.c with the following patch.


--- src/file.c.orig	Sat Sep  7 09:12:38 2002
+++ src/file.c	Sat Sep  7 09:53:48 2002
@@ -185,16 +185,20 @@
 int create_temp_fd(char **name)
 {
     int	fd;
-
-    *name = tmpnam(NULL);
-    if (!*name)
-	fd = -1;
-    else {
-	unlink(*name);
-	fd = open(*name, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
-	if (fd < 0)
-	    *name = NULL;
-    }
+    char filename[FILENAME_MAX];
+    
+    if (getenv("TMPDIR") != NULL) {
+    	strlcpy(filename, getenv("TMPDIR"), FILENAME_MAX);
+	strlcat(filename, "/tmp.XXXXXX", FILENAME_MAX); 
+    } else if (access("/var/tmp", (R_OK|W_OK)) == 0)
+	strlcpy(filename, "/var/tmp/tmp.XXXXXX", FILENAME_MAX); 
+    else
+	strlcpy(filename, "tmp.XXXXXX", FILENAME_MAX);
+	
+    if ((fd = mkstemp(filename)) == -1)
+	*name = NULL;
+    else
+        *name = filename;
 
     return fd;
 }

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209071706.g87H6o2D022065>