mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-27 04:18:42 +00:00
Simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118102 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
1 parent
d3a124db4d
commit
0803ebe0c8
1 file changed
+3
-6
@@ -141,8 +141,7 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
|
|||||||
#if defined(HAVE_MKDTEMP)
|
#if defined(HAVE_MKDTEMP)
|
||||||
// The best way is with mkdtemp but that's not available on many systems,
|
// The best way is with mkdtemp but that's not available on many systems,
|
||||||
// Linux and FreeBSD have it. Others probably won't.
|
// Linux and FreeBSD have it. Others probably won't.
|
||||||
char pathname[MAXPATHLEN];
|
char pathname[] = "/tmp/llvm_XXXXXX";
|
||||||
strcpy(pathname,"/tmp/llvm_XXXXXX");
|
|
||||||
if (0 == mkdtemp(pathname)) {
|
if (0 == mkdtemp(pathname)) {
|
||||||
MakeErrMsg(ErrMsg,
|
MakeErrMsg(ErrMsg,
|
||||||
std::string(pathname) + ": can't create temporary directory");
|
std::string(pathname) + ": can't create temporary directory");
|
||||||
@@ -158,8 +157,7 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
|
|||||||
// mktemp because of mktemp's inherent security and threading risks. We still
|
// mktemp because of mktemp's inherent security and threading risks. We still
|
||||||
// have a slight race condition from the time the temporary file is created to
|
// have a slight race condition from the time the temporary file is created to
|
||||||
// the time it is re-created as a directoy.
|
// the time it is re-created as a directoy.
|
||||||
char pathname[MAXPATHLEN];
|
char pathname[] = "/tmp/llvm_XXXXXX";
|
||||||
strcpy(pathname, "/tmp/llvm_XXXXXX");
|
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
if (-1 == (fd = mkstemp(pathname))) {
|
if (-1 == (fd = mkstemp(pathname))) {
|
||||||
MakeErrMsg(ErrMsg,
|
MakeErrMsg(ErrMsg,
|
||||||
@@ -183,8 +181,7 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
|
|||||||
// implementation of mktemp(3) and doesn't follow BSD 4.3's lead of replacing
|
// implementation of mktemp(3) and doesn't follow BSD 4.3's lead of replacing
|
||||||
// the XXXXXX with the pid of the process and a letter. That leads to only
|
// the XXXXXX with the pid of the process and a letter. That leads to only
|
||||||
// twenty six temporary files that can be generated.
|
// twenty six temporary files that can be generated.
|
||||||
char pathname[MAXPATHLEN];
|
char pathname[] = "/tmp/llvm_XXXXXX";
|
||||||
strcpy(pathname, "/tmp/llvm_XXXXXX");
|
|
||||||
char *TmpName = ::mktemp(pathname);
|
char *TmpName = ::mktemp(pathname);
|
||||||
if (TmpName == 0) {
|
if (TmpName == 0) {
|
||||||
MakeErrMsg(ErrMsg,
|
MakeErrMsg(ErrMsg,
|
||||||
|
|||||||
Reference in new issue
Block a user