summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-02 22:50:10 +0000
committerDan Gohman <gohman@apple.com>2010-11-02 22:50:10 +0000
commit32d51fa0b5f796f0d201c471907a6891dd9e929c (patch)
tree6bc958d62ba6df813520a39c1417436ae91f0f75 /llvm/lib/System/Unix
parent23436b65308837637c786ea7c46a9cc6da66d17c (diff)
downloadbcm5719-llvm-32d51fa0b5f796f0d201c471907a6891dd9e929c.tar.gz
bcm5719-llvm-32d51fa0b5f796f0d201c471907a6891dd9e929c.zip
Simplify this code.
llvm-svn: 118102
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r--llvm/lib/System/Unix/Path.inc9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index 571ecbd401a..c1765b81793 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -141,8 +141,7 @@ Path::GetTemporaryDirectory(std::string *ErrMsg) {
#if defined(HAVE_MKDTEMP)
// The best way is with mkdtemp but that's not available on many systems,
// Linux and FreeBSD have it. Others probably won't.
- char pathname[MAXPATHLEN];
- strcpy(pathname,"/tmp/llvm_XXXXXX");
+ char pathname[] = "/tmp/llvm_XXXXXX";
if (0 == mkdtemp(pathname)) {
MakeErrMsg(ErrMsg,
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
// have a slight race condition from the time the temporary file is created to
// the time it is re-created as a directoy.
- char pathname[MAXPATHLEN];
- strcpy(pathname, "/tmp/llvm_XXXXXX");
+ char pathname[] = "/tmp/llvm_XXXXXX";
int fd = 0;
if (-1 == (fd = mkstemp(pathname))) {
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
// the XXXXXX with the pid of the process and a letter. That leads to only
// twenty six temporary files that can be generated.
- char pathname[MAXPATHLEN];
- strcpy(pathname, "/tmp/llvm_XXXXXX");
+ char pathname[] = "/tmp/llvm_XXXXXX";
char *TmpName = ::mktemp(pathname);
if (TmpName == 0) {
MakeErrMsg(ErrMsg,
OpenPOWER on IntegriCloud