This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] use mkstemp instead of mktemp.
- From: Muthukumar Ratty <muthu at iqmail dot net>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Tue, 1 Jul 2003 19:16:30 -0700 (PDT)
- Subject: Re: [patch] use mkstemp instead of mktemp.
> <URL:http://sources.redhat.com/ml/binutils/2003-03/msg00219.html>.
>
> This is turning into a FAQ, though infrequent enough that I
> believe people may forget why. Perhaps adding an obvious
> comment at the mktemp call site would help.
>
that sure would keep off some newbie trying it (like me:)
how about the following ...
--- binutils-cvs/bucomm.c Tue Jul 1 18:53:53 2003
+++ binutils/bucomm.c Tue Jul 1 19:13:49 2003
@@ -438,6 +438,7 @@ make_tempname (filename)
#endif
strcat (tmpname, "/");
strcat (tmpname, template);
+ /* mkstemp won't work with directories. so use mktemp */
mktemp (tmpname);
*slash = c;
}
@@ -445,6 +446,7 @@ make_tempname (filename)
{
tmpname = xmalloc (sizeof (template));
strcpy (tmpname, template);
+ /* mkstemp won't work with directories. so use mktemp */
mktemp (tmpname);
}
return tmpname;
> brgds, H-P
>