summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/JavaUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/JavaUtil.cpp')
-rw-r--r--cpp/src/Slice/JavaUtil.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index 9ad435fbae7..b2ad3602631 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -754,7 +754,14 @@ Slice::JavaOutput::openClass(const string& cls, const string& prefix, const stri
continue;
}
- if(IceUtilInternal::mkdir(path, 0777) != 0)
+ int err = IceUtilInternal::mkdir(path, 0777);
+ // If slice2java is run concurrently, it's possible that another instance of slice2java has already
+ // created the directory.
+ if (err == 0 || (errno == EEXIST && IceUtilInternal::directoryExists(path)))
+ {
+ // Directory successfully created or already exists.
+ }
+ else
{
ostringstream os;
os << "cannot create directory `" << path << "': " << IceUtilInternal::errorToString(errno);