🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Ralf E. Stranzenbach Sat, 01 Aug 1992 19:58
tmpnam () is _bad_
#404
Author: Ralf E. Stranzenbach
Date: Sat, 01 Aug 1992 19:58
38 lines
1522 bytes
Hi,

i'm using NeXTstep 2.1. Today i noted, that the function "tmpnam ()" is not  
working correctly. See this example:

	#include <stdio.h>
	main () {
	  char   file1 [1024];
	  char   file2 [1024];
	  char   file3 [1024];
	  FILE * fp;
	  if ( (fp = fopen (tmpnam (file1), "w")) != NULL ) {
	    fclose (fp);
	  }
	  if ( (fp = fopen (tmpnam (file2), "w")) != NULL ) {
	    fclose (fp);
	  }
	  if ( (fp = fopen (tmpnam (file3), "w")) != NULL ) {
	    fclose (fp);
	  }
	  printf ("-%s-%s-%s-\n", file1, file2, file3);
	  unlink (file1);	
	  unlink (file2);
	  unlink (file3);
	  exit (0);
	}

In this example "tmpnam ()" returns three times the same filename.

	- ralf

--
Ralf E.Stranzenbach  -   (NeXT)-Mail: ralf@reswi.en.open.de
                                Fido: Ralf_Stranzenbach 2:245/5800.12
                       (Voice)-Phone: +49 2302 / 68403
--
Wenn ein Programm bei Dir fehlerfrei laeuft, mach Dir keine Sorgen.
Es wird vorbeigehen.
Re: tmpnam () is _bad_
#422
Author: Thomas Funke
Date: Mon, 03 Aug 1992 09:33
24 lines
1321 bytes
In article <1992Aug1.195837.2455@reswi.en.open.de> ralf@reswi.en.open.de  
(Ralf E. Stranzenbach) writes:
> Hi,
> 
> i'm using NeXTstep 2.1. Today i noted, that the function "tmpnam ()" is  
not  
> working correctly. See this example:
> 

There are several routines from the runtime-lib which just don't work.  
tmpnam is one of them. Actually it is a 5-line routine, so I really don't  
understand why there is such a bug at all .....

I sent a bug report to NeXT already, and they said they have fixed it in  
3.0. 

Users of CVS beware: You have to hack the sources to make 'cvs patch'  
working !!!

-- 
------------------------------------------------------------------
Thomas Funke  ** E-mail: thf@zelator.in-berlin.de
NeXT-Developer * Unix-Consultant
------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads