summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/IceGridNode.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2010-01-13 15:33:33 +0100
committerBenoit Foucher <benoit@zeroc.com>2010-01-13 15:33:33 +0100
commit8b887d75d1720dde3b595545ceaace8b63744678 (patch)
treee30bf48e7f8011aecf781e6fbbc71b7f0e7c268b /cpp/src/IceGrid/IceGridNode.cpp
parentMake BCC2010 the default compiler for nmake builds (diff)
downloadice-8b887d75d1720dde3b595545ceaace8b63744678.tar.bz2
ice-8b887d75d1720dde3b595545ceaace8b63744678.tar.xz
ice-8b887d75d1720dde3b595545ceaace8b63744678.zip
Fixed bug 4548 - disable indexing on IceGrid node directories
Diffstat (limited to 'cpp/src/IceGrid/IceGridNode.cpp')
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index 87ef58eaedb..4b435ef4d62 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -121,6 +121,29 @@ private:
ObjectPtr _servant;
};
+#ifdef _WIN32
+void
+setNoIndexingAttribute(const string& pa)
+{
+ wstring path = IceUtil::stringToWstring(pa);
+ DWORD attrs = GetFileAttributesW(path.c_str());
+ if(attrs == INVALID_FILE_ATTRIBUTES)
+ {
+ FileException ex(__FILE__, __LINE__);
+ ex.path = pa;
+ ex.error = IceInternal::getSystemErrno();
+ throw ex;
+ }
+ if(!SetFileAttributesW(path.c_str(), attrs | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED))
+ {
+ FileException ex(__FILE__, __LINE__);
+ ex.path = pa;
+ ex.error = IceInternal::getSystemErrno();
+ throw ex;
+ }
+}
+#endif
+
}
@@ -386,6 +409,29 @@ NodeService::startImpl(int argc, char* argv[], int& status)
IcePatch2::createDirectory(dataPath + "servers");
IcePatch2::createDirectory(dataPath + "tmp");
IcePatch2::createDirectory(dataPath + "distrib");
+
+#ifdef _WIN32
+ //
+ // Make sure these directories are not indexed by the Windows
+ // indexing service (which can cause random "Access Denied"
+ // errors if indexing runs at the same time as the node is
+ // creating/deleting files).
+ //
+ try
+ {
+ setNoIndexingAttribute(dataPath + "servers");
+ setNoIndexingAttribute(dataPath + "tmp");
+ setNoIndexingAttribute(dataPath + "distrib");
+ }
+ catch(const FileException& ex)
+ {
+ if(!nowarn)
+ {
+ Warning out(communicator()->getLogger());
+ out << "couldn't disable file indexing:\n" << ex;
+ }
+ }
+#endif
}
//