Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!math.ohio-state.edu!howland.reston.ans.net!agate!asami
From: asami@cs.berkeley.edu (Satoshi ASAMI)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: mktemp() crashes
Date: 27 Oct 93 16:47:35
Organization: CS Div. - EECS, University of California, Berkeley, CA 94720
Lines: 38
Message-ID: <ASAMI.93Oct27164735@forgery.cs.berkeley.edu>
References: <CF7snJ.ID9@dvorak.amd.com> <1993Oct21.093717.2658@zen.void.oz.au>
<1993Oct21.120854.2900@zen.void.oz.au>
<JKH.93Oct25234522@whisker.lotus.ie>
<1993Oct27.125403.15527@zen.void.oz.au>
NNTP-Posting-Host: forgery.cs.berkeley.edu
In-reply-to: sjg@zen.void.oz.au's message of Wed, 27 Oct 1993 05:54:03 PDT
In article <1993Oct27.125403.15527@zen.void.oz.au>
sjg@zen.void.oz.au (Simon J. Gerraty) writes:
* >BLETCH!! That's no fix at all! Please don't apply it, anyone.
* >Repeated calls to mktemp() will not DTRT, ...
* What is The Right Thing to do for repeated calls of mktemp()?
* A series of unique filenames is about the only result that makes any
* sense.
I don't know why you guys stared argue about that. The issue is not
repeated calls to mktemp(). My mktemp man page says:
char *mktemp(template)
char *template;
Description
The mktemp subroutine replaces template by a unique file name, and
returns the address of the template. The template should look like a
So it is supposed to REPLACE the template, as well as return the
address of the argument to report success. It's not allowed to copy
the template to a different place and return the modified version of
the new copy.
The proposed "patch" will break legal programs like this, so it's not
acceptable.
char *s = strdup("/tmp/fooXXXXXX") ;
if (mktemp(s)[0] == '\0') { error.... }
printf("%s\n", s) ;
---
o o Satoshi Asami
Form follows Function. ^
(asami@CS.Berkeley.EDU)
Tel: (510)547-0336 (home) Computer Science Div., Dept. of EECS
(510)642-1845 (office) University of California at Berkeley