projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix possible bug when no args have been provided to the executable
[deliverable/binutils-gdb.git]
/
libiberty
/
choose-temp.c
diff --git
a/libiberty/choose-temp.c
b/libiberty/choose-temp.c
index 5c2c6140dbf52bb4fcd04be5380f426ebb19fa37..16edb20f3ea46ee61132d8416ced4e3ffd4d3e26 100644
(file)
--- a/
libiberty/choose-temp.c
+++ b/
libiberty/choose-temp.c
@@
-1,5
+1,5
@@
/* Utility to pick a temporary filename prefix.
/* Utility to pick a temporary filename prefix.
- Copyright (C) 1996
, 1997, 1998
Free Software Foundation, Inc.
+ Copyright (C) 1996
-2017
Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
@@
-14,14
+14,18
@@
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If not,
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If not,
-write to the Free Software Foundation, Inc., 5
9 Temple Place - Suite 330
,
-Boston, MA 0211
1-1307
, USA. */
+write to the Free Software Foundation, Inc., 5
1 Franklin Street - Fifth Floor
,
+Boston, MA 0211
0-1301
, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> /* May get P_tmpdir. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> /* May get P_tmpdir. */
+#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@@
-30,7
+34,6
@@
Boston, MA 02111-1307, USA. */
#endif
#include "libiberty.h"
#endif
#include "libiberty.h"
-extern char *choose_tmpdir PARAMS ((void));
/* Name of temporary file.
mktemp requires 6 trailing X's. */
/* Name of temporary file.
mktemp requires 6 trailing X's. */
@@
-46,7
+49,7
@@
find one. The current directory is chosen if all else fails so the
program is exited if a temporary directory can't be found (@code{mktemp}
fails). The buffer for the result is obtained with @code{xmalloc}.
program is exited if a temporary directory can't be found (@code{mktemp}
fails). The buffer for the result is obtained with @code{xmalloc}.
-This function is provided for backwards compat
a
bility only. Its use is
+This function is provided for backwards compat
i
bility only. Its use is
not recommended.
@end deftypefn
not recommended.
@end deftypefn
@@
-54,19
+57,18
@@
not recommended.
*/
char *
*/
char *
-choose_temp_base ()
+choose_temp_base (
void
)
{
const char *base = choose_tmpdir ();
char *temp_filename;
int len;
len = strlen (base);
{
const char *base = choose_tmpdir ();
char *temp_filename;
int len;
len = strlen (base);
- temp_filename =
xmalloc (
len + TEMP_FILE_LEN + 1);
+ temp_filename =
XNEWVEC (char,
len + TEMP_FILE_LEN + 1);
strcpy (temp_filename, base);
strcpy (temp_filename + len, TEMP_FILE);
strcpy (temp_filename, base);
strcpy (temp_filename + len, TEMP_FILE);
- mktemp (temp_filename);
- if (strlen (temp_filename) == 0)
+ if (mktemp (temp_filename) == 0)
abort ();
return temp_filename;
}
abort ();
return temp_filename;
}
This page took
0.024188 seconds
and
4
git commands to generate.