🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #404

tmpnam () is _bad_

#404
From: 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.
Technical Details
Message-ID: <1992Aug1.195837.2455@reswi.en.open.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!iWarp.intel.com|imutm1.de.intel.com!mamunx!horga!ruhr.de!reswi!news

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer,de.comp.sys.next
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!eff!iWarp.intel.com|imutm1.de.intel.com!mamunx!horga!ruhr.de!reswi!news
From: ralf@reswi.en.open.de (Ralf E. Stranzenbach)
Subject: tmpnam () is _bad_
Message-ID: <1992Aug1.195837.2455@reswi.en.open.de>
Sender: news@reswi.en.open.de
Nntp-Posting-Host: localhost
Organization: News on  RESWI from ENtenhausen.OPEN.DE
Date: Sat, 1 Aug 1992 19:58:37 GMT
Lines: 38