creating storage and domain paths if not existent

git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@842 8eb893ce-cfd4-0310-b710-fb5ebe64c474
sayer/1.4-spce2.6
Stefan Sayer 18 years ago
parent dea815c498
commit 3a3c33dfbb

@ -39,9 +39,18 @@ int MsgStorage::onLoad() {
DBG("storage_dir set to '%s'.\n", msg_dir.c_str());
}
string path = msg_dir + "/_test_dir_";
string path = msg_dir;
int status = mkdir(path.c_str(),
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (status && (errno != EEXIST)) {
ERROR("creating storage path '%s': %s\n",
path.c_str(),strerror(errno));
return -1;
}
path = msg_dir + "/_test_dir_";
status = mkdir(path.c_str(),
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (status && (errno != EEXIST)) {
ERROR("creating test path in storage '%s': %s\n",
path.c_str(),strerror(errno));
@ -107,7 +116,7 @@ void MsgStorage::invoke(const string& method,
int MsgStorage::msg_new(string domain, string user,
string msg_name, FILE* data) {
string path = msg_dir+ "/" + domain + "/" + user + "/";
string path = msg_dir+ "/" + domain + "/" ;
int status = mkdir(path.c_str(),
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (status && (errno != EEXIST)) {
@ -116,6 +125,15 @@ int MsgStorage::msg_new(string domain, string user,
return MSG_EUSRNOTFOUND;
}
path = msg_dir+ "/" + domain + "/" + user + "/";
status = mkdir(path.c_str(),
S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (status && (errno != EEXIST)) {
ERROR("creating '%s': %s\n",
path.c_str(),strerror(errno));
return MSG_EUSRNOTFOUND;
}
FILE* fp = fopen((path + msg_name).c_str(), "wb");
if (!fp) {
ERROR("creating '%s': %s\n",

Loading…
Cancel
Save