X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gold%2Fplugin.cc;h=8963c7fa4c8665c503749ab4540c5811cc0e25d0;hb=e822f2cda9bc484adb5f8860050640a5c6f1ced9;hp=3415b914ad679bbf93a7601ea83c6652c3918334;hpb=0b7a4aa6ba5a144b7ce616e80e95d9ff944fec2e;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/plugin.cc b/gold/plugin.cc index 3415b914ad..8963c7fa4c 100644 --- a/gold/plugin.cc +++ b/gold/plugin.cc @@ -1,6 +1,6 @@ // plugin.cc -- plugin manager for gold -*- C++ -*- -// Copyright (C) 2008-2018 Free Software Foundation, Inc. +// Copyright (C) 2008-2020 Free Software Foundation, Inc. // Written by Cary Coutant . // This file is part of gold. @@ -508,8 +508,20 @@ Plugin_recorder::init() // Create a temporary directory where we can stash the log and // copies of replacement files. char dir_template[] = "gold-recording-XXXXXX"; +#ifdef HAVE_MKDTEMP if (mkdtemp(dir_template) == NULL) return false; +#else + if (mktemp(dir_template) == NULL) + return false; +#if defined (_WIN32) && !defined (__CYGWIN32__) + if (mkdir(dir_template) != 0) + return false; +#else + if (mkdir(dir_template, 0700) != 0) + return false; +#endif +#endif size_t len = strlen(dir_template) + 1; char* tempdir = new char[len]; @@ -562,8 +574,10 @@ link_or_copy_file(const char* inname, const char* outname) { static char buf[4096]; +#ifdef HAVE_LINK if (::link(inname, outname) == 0) return true; +#endif int in = ::open(inname, O_RDONLY); if (in < 0)