This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
slightly modified version of suggested patch
authorSteven N. Hirsch <hirschs@stargate.btv.ibm.com>
Mon, 28 Jun 1999 14:23:59 +0000 (10:23 -0400)
committerGurusamy Sarathy <gsar@cpan.org>
Wed, 7 Jul 1999 10:00:57 +0000 (10:00 +0000)
Message-Id: <199906281823.OAA24912@stargate.btv.ibm.com>
Subject: [ID 19990628.007] POSIX::tmpnam() broken for threaded 5.00503

p4raw-id: //depot/perl@3641

ext/POSIX/POSIX.xs

index 9702923..bbf9a7a 100644 (file)
@@ -1526,9 +1526,10 @@ constant(char *name, int arg)
 #else
                goto not_there;
 #endif
-           if (strEQ(name, "L_tmpname"))
-#ifdef L_tmpname
-               return L_tmpname;
+           /* L_tmpnam[e] was a typo--retained for compatibility */
+           if (strEQ(name, "L_tmpname") || strEQ(name, "L_tmpnam"))
+#ifdef L_tmpnam
+               return L_tmpnam;
 #else
                goto not_there;
 #endif
@@ -3374,9 +3375,18 @@ write(fd, buffer, nbytes)
        char *          buffer
        size_t          nbytes
 
-char *
-tmpnam(s = 0)
-       char *          s = 0;
+SV *
+tmpnam()
+    PREINIT:
+       STRLEN i;
+       int len;
+    CODE:
+       RETVAL = newSVpvn("", 0);
+       SvGROW(RETVAL, L_tmpnam);
+       len = strlen(tmpnam(SvPV(RETVAL, i)));
+       SvCUR_set(RETVAL, len);
+    OUTPUT:
+       RETVAL
 
 void
 abort()