From gjohnson@nola.srrc.usda.gov  Wed May 31 20:17:21 2000
Return-Path: <gjohnson@nola.srrc.usda.gov>
Received: from symbion.srrc.usda.gov (symbion.srrc.usda.gov [199.133.86.40])
	by hub.freebsd.org (Postfix) with ESMTP id B346337B509
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 31 May 2000 20:17:19 -0700 (PDT)
	(envelope-from gjohnson@nola.srrc.usda.gov)
Received: (from glenn@localhost)
	by symbion.srrc.usda.gov (8.9.3/8.9.3) id WAA73146;
	Wed, 31 May 2000 22:17:18 -0500 (CDT)
	(envelope-from glenn)
Message-Id: <200006010317.WAA73146@symbion.srrc.usda.gov>
Date: Wed, 31 May 2000 22:17:18 -0500 (CDT)
From: Glenn Johnson <gjohnson@nola.srrc.usda.gov>
Reply-To: Glenn Johnson <gjohnson@nola.srrc.usda.gov>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Fix libg2c mktemp() problem
X-Send-Pr-Version: 3.2

>Number:         18930
>Category:       gnu
>Synopsis:       Fix mktemp() problem with libg2c
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    obrien
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 31 20:20:00 PDT 2000
>Closed-Date:    Fri Nov 10 09:52:58 PST 2000
>Last-Modified:  Fri Nov 10 09:54:16 PST 2000
>Originator:     Glenn Johnson
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
>Environment:

	FreeBSD 4-STABLE.

>Description:

        libg2c uses mktemp() and tempnam() which causes all Fortran
programs linked with it to issue a warning upon linking and of course
makes the resulting binaries susceptible to problems of mktemp().

>How-To-Repeat:

        Compile and link any Fortran program with FreeBSD 4. I do not
know if this applies to CURRENT, but I suspect it does.

>Fix:

        Apply the following patch in the /usr/src/contrib/libf2c/libI77
subdirectory.

--- rawio.h.orig	Wed May 31 18:05:12 2000
+++ rawio.h	Wed May 31 18:05:22 2000
@@ -28,7 +28,7 @@
 #endif
 #endif /*KR_HEADERS*/
 
-extern char *mktemp(char*);
+extern char *mkstemp(char*);
 
 #ifdef __cplusplus
 	}
--- open.c.orig	Wed May 31 18:05:30 2000
+++ open.c	Wed May 31 18:05:59 2000
@@ -15,7 +15,7 @@
 #ifdef KR_headers
 extern char *malloc();
 #ifdef NON_ANSI_STDIO
-extern char *mktemp();
+extern char *mkstemp();
 #endif
 extern integer f_clos();
 #else
@@ -210,7 +210,7 @@
 	 case 'S':
 		b->uscrtch=1;
 #ifdef HAVE_TEMPNAM		/* Allow use of TMPDIR preferentially. */
-		s = tempnam (0, buf);
+		s = mkstemp (buf);
 		if (strlen (s) >= sizeof (buf))
 		  err (a->oerr, 132, "open");
 		(void) strcpy (buf, s);
@@ -220,7 +220,7 @@
 		tmpnam(buf);
 #else
 		(void) strcpy(buf,"tmp.FXXXXXX");
-		(void) mktemp(buf);
+		(void) mkstemp(buf);
 #endif
 #endif /* ! defined (HAVE_TEMPNAM) */
 		goto replace;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->obrien 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Aug 7 06:47:10 PDT 2000 
Responsible-Changed-Why:  
Although f2c has been punted into the compat hierarchy, it's 
going to stay there for a while.  David can decide whether 
this is worth chasing up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18930 
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Fri Nov 10 09:52:58 PST 2000 
State-Changed-Why:  
I don't make such supurlative changes in src/contrib/ software. 
Maybe a PR should be opened on the code that outputs the warning and have 
a way to turn it off on a case by case basis. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=18930 
>Unformatted:
