mktemp -> mkstemp
-- Ok'd by maintainer
This commit is contained in:
parent
b40f7c598f
commit
e16438647f
11
devel/binutils/stable/patches/patch-binutils_ar_c
Normal file
11
devel/binutils/stable/patches/patch-binutils_ar_c
Normal file
@ -0,0 +1,11 @@
|
||||
--- binutils/ar.c.orig Wed Feb 20 17:35:04 2002
|
||||
+++ binutils/ar.c Wed Feb 20 17:42:49 2002
|
||||
@@ -1077,7 +1077,7 @@
|
||||
|
||||
old_name = xmalloc (strlen (bfd_get_filename (iarch)) + 1);
|
||||
strcpy (old_name, bfd_get_filename (iarch));
|
||||
- new_name = make_tempname (old_name);
|
||||
+ new_name = make_tempname (old_name, 0);
|
||||
|
||||
output_filename = new_name;
|
||||
|
62
devel/binutils/stable/patches/patch-binutils_bucomm_c
Normal file
62
devel/binutils/stable/patches/patch-binutils_bucomm_c
Normal file
@ -0,0 +1,62 @@
|
||||
--- binutils/bucomm.c.orig Wed Feb 20 17:35:00 2002
|
||||
+++ binutils/bucomm.c Wed Feb 20 17:40:47 2002
|
||||
@@ -208,12 +208,14 @@
|
||||
/* Return the name of a temporary file in the same directory as FILENAME. */
|
||||
|
||||
char *
|
||||
-make_tempname (filename)
|
||||
+make_tempname (filename, isdir)
|
||||
char *filename;
|
||||
+ int isdir;
|
||||
{
|
||||
static char template[] = "stXXXXXX";
|
||||
char *tmpname;
|
||||
char *slash = strrchr (filename, '/');
|
||||
+ char c;
|
||||
|
||||
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|
||||
{
|
||||
@@ -228,8 +230,6 @@
|
||||
|
||||
if (slash != (char *) NULL)
|
||||
{
|
||||
- char c;
|
||||
-
|
||||
c = *slash;
|
||||
*slash = 0;
|
||||
tmpname = xmalloc (strlen (filename) + sizeof (template) + 2);
|
||||
@@ -243,15 +243,31 @@
|
||||
#endif
|
||||
strcat (tmpname, "/");
|
||||
strcat (tmpname, template);
|
||||
- mktemp (tmpname);
|
||||
- *slash = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpname = xmalloc (sizeof (template));
|
||||
strcpy (tmpname, template);
|
||||
- mktemp (tmpname);
|
||||
}
|
||||
+
|
||||
+ if (isdir)
|
||||
+ {
|
||||
+ if (mkdtemp (tmpname) != (char *) NULL)
|
||||
+ tmpname = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ int fd;
|
||||
+
|
||||
+ fd = mkstemp (tmpname);
|
||||
+ if (fd == -1)
|
||||
+ tmpname = NULL;
|
||||
+ else
|
||||
+ close (fd);
|
||||
+ }
|
||||
+ if (slash != (char *) NULL)
|
||||
+ *slash = c;
|
||||
+
|
||||
return tmpname;
|
||||
}
|
||||
|
11
devel/binutils/stable/patches/patch-binutils_bucomm_h
Normal file
11
devel/binutils/stable/patches/patch-binutils_bucomm_h
Normal file
@ -0,0 +1,11 @@
|
||||
--- binutils/bucomm.h.orig Wed Feb 20 18:35:42 2002
|
||||
+++ binutils/bucomm.h Wed Feb 20 18:36:24 2002
|
||||
@@ -166,7 +166,7 @@
|
||||
|
||||
void print_arelt_descr PARAMS ((FILE *file, bfd *abfd, boolean verbose));
|
||||
|
||||
-char *make_tempname PARAMS ((char *));
|
||||
+char *make_tempname PARAMS ((char *, int));
|
||||
|
||||
bfd_vma parse_vma PARAMS ((const char *, const char *));
|
||||
|
29
devel/binutils/stable/patches/patch-binutils_objcopy_c
Normal file
29
devel/binutils/stable/patches/patch-binutils_objcopy_c
Normal file
@ -0,0 +1,29 @@
|
||||
--- binutils/objcopy.c.orig Fri Mar 8 10:02:46 2002
|
||||
+++ binutils/objcopy.c Fri Mar 8 10:03:36 2002
|
||||
@@ -1243,7 +1243,7 @@
|
||||
} *list, *l;
|
||||
bfd **ptr = &obfd->archive_head;
|
||||
bfd *this_element;
|
||||
- char *dir = make_tempname (bfd_get_filename (obfd));
|
||||
+ char *dir = make_tempname (bfd_get_filename (obfd), 1);
|
||||
|
||||
/* Make a temp directory to hold the contents. */
|
||||
#if defined (_WIN32) && !defined (__CYGWIN32__)
|
||||
@@ -1933,7 +1933,7 @@
|
||||
if (output_file != NULL)
|
||||
tmpname = output_file;
|
||||
else
|
||||
- tmpname = make_tempname (argv[i]);
|
||||
+ tmpname = make_tempname (argv[i], 0);
|
||||
status = 0;
|
||||
|
||||
copy_file (argv[i], tmpname, input_target, output_target);
|
||||
@@ -2370,7 +2370,7 @@
|
||||
|
||||
if (output_filename == (char *) NULL)
|
||||
{
|
||||
- char *tmpname = make_tempname (input_filename);
|
||||
+ char *tmpname = make_tempname (input_filename, 0);
|
||||
|
||||
copy_file (input_filename, tmpname, input_target, output_target);
|
||||
if (status == 0)
|
14
devel/binutils/stable/patches/patch-include_libiberty_h
Normal file
14
devel/binutils/stable/patches/patch-include_libiberty_h
Normal file
@ -0,0 +1,14 @@
|
||||
--- include/libiberty.h.orig Wed Feb 20 18:12:05 2002
|
||||
+++ include/libiberty.h Wed Feb 20 18:16:30 2002
|
||||
@@ -48,6 +48,11 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
+/* Make temporary file name */
|
||||
+
|
||||
+extern int mkstemp PARAMS ((char *));
|
||||
+extern char *mkdtemp PARAMS ((char *));
|
||||
+
|
||||
/* Build an argument vector from a string. Allocates memory using
|
||||
malloc. Use freeargv to free the vector. */
|
||||
|
Loading…
Reference in New Issue
Block a user