This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: "dangerous" warning question
- From: NightStrike <nightstrike at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Sun, 26 Aug 2007 23:35:43 -0400
- Subject: Re: "dangerous" warning question
- References: <b609cb3b0707141944w199990dci77590272de78663c@mail.gmail.com> <46999950.7EC77946@dessent.net> <b609cb3b0707142110x1dcf3850yd68ef3e8689fc305@mail.gmail.com> <4699BB0B.509E9F8C@dessent.net>
On 7/15/07, Brian Dessent <brian@dessent.net> wrote:
> NightStrike wrote:
>
> And in fact the above already exists in libiberty as make_temp_file, so
> it looks like the best short term solution would be to replace users of
> choose_temp_base with that. (Although there is also make_tempname in
> bucomm.c that might be usable but this has the strange logic that if the
> target doesn't have mkstemp it falls back to mktemp instead of using the
> mkstemps replacement that's in libiberty...)
Would this patch be acceptable?
Index: binutils/dlltool.c
===================================================================
RCS file: /cvs/src/src/binutils/dlltool.c,v
retrieving revision 1.78
diff -u -r1.78 dlltool.c
--- binutils/dlltool.c 5 Jul 2007 16:54:45 -0000 1.78
+++ binutils/dlltool.c 27 Aug 2007 03:34:51 -0000
@@ -1174,7 +1174,7 @@
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
- char *temp_base = choose_temp_base ();
+ char *temp_base = make_temp_file (NULL);
inform ("run: %s %s", what, args);
Index: binutils/dllwrap.c
===================================================================
RCS file: /cvs/src/src/binutils/dllwrap.c,v
retrieving revision 1.23
diff -u -r1.23 dllwrap.c
--- binutils/dllwrap.c 5 Jul 2007 16:54:45 -0000 1.23
+++ binutils/dllwrap.c 27 Aug 2007 03:34:51 -0000
@@ -346,7 +346,7 @@
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
- char *temp_base = choose_temp_base ();
+ char *temp_base = make_temp_file (NULL);
int in_quote;
char sep;
@@ -799,7 +799,7 @@
if (! def_file_seen)
{
- char *fileprefix = choose_temp_base ();
+ char *fileprefix = make_temp_file (NULL);
def_file_name = (char *) xmalloc (strlen (fileprefix) + 5);
sprintf (def_file_name, "%s.def",
@@ -982,7 +982,7 @@
if (! base_file_name)
{
- char *fileprefix = choose_temp_base ();
+ char *fileprefix = make_temp_file (NULL);
base_file_name = (char *) xmalloc (strlen (fileprefix) + 6);
sprintf (base_file_name, "%s.base",
(dontdeltemps) ? mybasename (fileprefix) : fileprefix);
Index: binutils/resrc.c
===================================================================
RCS file: /cvs/src/src/binutils/resrc.c,v
retrieving revision 1.32
diff -u -r1.32 resrc.c
--- binutils/resrc.c 5 Jul 2007 16:54:45 -0000 1.32
+++ binutils/resrc.c 27 Aug 2007 03:34:51 -0000
@@ -207,7 +207,7 @@
int i;
const char **argv;
char *errmsg_fmt, *errmsg_arg;
- char *temp_base = choose_temp_base ();
+ char *temp_base = make_temp_file (NULL);
int in_quote;
char sep;
int redir_handle = -1;
@@ -318,9 +318,8 @@
{
if (istream_type == ISTREAM_FILE)
{
- char *fileprefix;
+ char *fileprefix = make_temp_file (NULL);
- fileprefix = choose_temp_base ();
cpp_temp_file = (char *) xmalloc (strlen (fileprefix) + 5);
sprintf (cpp_temp_file, "%s.irc", fileprefix);
free (fileprefix);