summaryrefslogtreecommitdiff
path: root/cpp/src/slice2matlab/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2matlab/Main.cpp')
-rw-r--r--cpp/src/slice2matlab/Main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/cpp/src/slice2matlab/Main.cpp b/cpp/src/slice2matlab/Main.cpp
index 681664126b6..51b507aff70 100644
--- a/cpp/src/slice2matlab/Main.cpp
+++ b/cpp/src/slice2matlab/Main.cpp
@@ -283,7 +283,14 @@ openClass(const string& abs, const string& dir, IceUtilInternal::Output& out)
path += "+" + lookupKwd(v[i]);
if(!IceUtilInternal::directoryExists(path))
{
- if(IceUtilInternal::mkdir(path, 0777) != 0)
+ int err = IceUtilInternal::mkdir(path, 0777);
+ // If slice2matlab is run concurrently, it's possible that another instance of slice2matlab 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);