$OpenBSD: patch-binutils_objcopy_c,v 1.6 2004/01/08 02:09:54 brad Exp $
--- binutils/objcopy.c.orig	2003-06-02 16:35:15.000000000 -0400
+++ binutils/objcopy.c	2004-01-02 21:36:44.000000000 -0500
@@ -1340,13 +1340,6 @@ copy_object (ibfd, obfd)
     }
 }
 
-#undef MKDIR
-#if defined (_WIN32) && !defined (__CYGWIN32__)
-#define MKDIR(DIR, MODE) mkdir (DIR)
-#else
-#define MKDIR(DIR, MODE) mkdir (DIR, MODE)
-#endif
-
 /* Read each archive element in turn from IBFD, copy the
    contents to temp file, and keep the temp file handle.  */
 
@@ -1364,13 +1357,13 @@ copy_archive (ibfd, obfd, output_target)
     } *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 (MKDIR (dir, 0700) != 0)
+  if (dir == (char *) NULL)
     {
-      fatal (_("cannot mkdir %s for archive copying (error: %s)"),
-	     dir, strerror (errno));
+      fatal (_("cannot make temp directory for archive copying (error: %s)"),
+	     strerror (errno));
     }
   obfd->has_armap = ibfd->has_armap;
 
@@ -1396,11 +1389,11 @@ copy_archive (ibfd, obfd, output_target)
       /* If the file already exists, make another temp dir.  */
       if (stat (output_name, &buf) >= 0)
 	{
-	  output_name = make_tempname (output_name);
-	  if (MKDIR (output_name, 0700) != 0)
+	  output_name = make_tempname (output_name, 1);
+	  if (dir == (char *) NULL)
 	    {
-	      fatal (_("cannot mkdir %s for archive copying (error: %s)"),
-		     output_name, strerror (errno));
+	      fatal (_("cannot make temp directory for archive copying (error: %s)"),
+		     strerror (errno));
 	    }
 	  l = (struct name_list *) xmalloc (sizeof (struct name_list));
 	  l->name = output_name;
@@ -2204,7 +2197,7 @@ strip_main (argc, argv)
       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);
@@ -2738,7 +2731,7 @@ copy_main (argc, argv)
   if ((output_filename == (char *) NULL) ||
       (strcmp (input_filename, output_filename) == 0))
     {
-      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)
