mkstemp in bucomm.c breaks mingw32 build

Nick Clifton nickc@cambridge.redhat.com
Sun Nov 4 03:02:00 GMT 2001
Hi Danny,

> > libiberty provides mkstemps().  Perhaps that should be used instead?
> 
> Yes, that was my workaround.

Fair enough.  I will check in the patch below.

Cheers
        Nick


2001-11-14  Nick Clifton  <nickc@cambridge.redhat.com>

	* bucomm.c (make_tempname): Use mkstemps instead of mkstemp, since
	not all systems provide mkstemp.

Index: binutils/bucomm.c
===================================================================
RCS file: /cvs/src/src/binutils/bucomm.c,v
retrieving revision 1.11
diff -p -c -r1.11 bucomm.c
*** bucomm.c	2001/11/12 16:17:39	1.11
--- bucomm.c	2001/11/14 11:54:01
***************
*** 35,40 ****
--- 35,43 ----
  typedef long time_t;
  #endif
  #endif
+ 
+ /* Ought to be defined in libiberty.h...  */
+ extern int mkstemps PARAMS ((char *, int));
  
  /* Error reporting */
  
*************** make_tempname (filename)
*** 233,246 ****
  #endif
        strcat (tmpname, "/");
        strcat (tmpname, template);
!       close (mkstemp (tmpname));
        *slash = c;
      }
    else
      {
        tmpname = xmalloc (sizeof (template));
        strcpy (tmpname, template);
!       close (mkstemp (tmpname));
      }
    return tmpname;
  }
--- 236,249 ----
  #endif
        strcat (tmpname, "/");
        strcat (tmpname, template);
!       close (mkstemps (tmpname, 0));
        *slash = c;
      }
    else
      {
        tmpname = xmalloc (sizeof (template));
        strcpy (tmpname, template);
!       close (mkstemps (tmpname, 0));
      }
    return tmpname;
  }



More information about the Binutils mailing list