summaryrefslogtreecommitdiff
path: root/src/maildir-create.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/maildir-create.cc')
-rw-r--r--src/maildir-create.cc37
1 files changed, 14 insertions, 23 deletions
diff --git a/src/maildir-create.cc b/src/maildir-create.cc
index 6bbd7d7..6e08b61 100644
--- a/src/maildir-create.cc
+++ b/src/maildir-create.cc
@@ -6,22 +6,21 @@
* ----------------------------------------------------------------- **/
#include "maildir.h"
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
#include <errno.h>
+
+#include <fcntl.h>
#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
using namespace ::std;
using namespace Binc;
//------------------------------------------------------------------------
-bool Binc::Maildir::createMailbox(const string &s_in, mode_t mode,
- uid_t owner, gid_t group, bool root)
+bool Binc::Maildir::createMailbox(const string &s_in, mode_t mode, uid_t owner, gid_t group, bool root)
{
if (s_in != "." && mkdir(s_in.c_str(), mode) == -1) {
- setLastError("unable to create " + s_in + ": "
- + string(strerror(errno)));
+ setLastError("unable to create " + s_in + ": " + string(strerror(errno)));
return false;
}
@@ -30,47 +29,39 @@ bool Binc::Maildir::createMailbox(const string &s_in, mode_t mode,
sleep(1);
if (mkdir((s_in + "/cur").c_str(), mode) == -1) {
- setLastError("unable to create " + s_in + "/cur: "
- + string(strerror(errno)));
+ setLastError("unable to create " + s_in + "/cur: " + string(strerror(errno)));
return false;
}
if (mkdir((s_in + "/new").c_str(), mode) == -1) {
- setLastError("unable to create " + s_in + "/new: "
- + string(strerror(errno)));
+ setLastError("unable to create " + s_in + "/new: " + string(strerror(errno)));
return false;
}
if (mkdir((s_in + "/tmp").c_str(), mode) == -1) {
- setLastError("unable to create " + s_in + "/tmp: "
- + string(strerror(errno)));
+ setLastError("unable to create " + s_in + "/tmp: " + string(strerror(errno)));
return false;
}
- if (owner == 0 && group == 0)
- return true;
+ if (owner == 0 && group == 0) return true;
if (chown(s_in.c_str(), owner, group) == -1) {
- setLastError("unable to chown " + s_in + ": "
- + string(strerror(errno)));
+ setLastError("unable to chown " + s_in + ": " + string(strerror(errno)));
return false;
}
if (chown((s_in + "/cur").c_str(), owner, group) == -1) {
- setLastError("unable to chown " + s_in + "/cur: "
- + string(strerror(errno)));
+ setLastError("unable to chown " + s_in + "/cur: " + string(strerror(errno)));
return false;
}
if (chown((s_in + "/new").c_str(), owner, group) == -1) {
- setLastError("unable to chown " + s_in + "/new: "
- + string(strerror(errno)));
+ setLastError("unable to chown " + s_in + "/new: " + string(strerror(errno)));
return false;
}
if (chown((s_in + "/tmp").c_str(), owner, group) == -1) {
- setLastError("unable to chown " + s_in + "/tmp: "
- + string(strerror(errno)));
+ setLastError("unable to chown " + s_in + "/tmp: " + string(strerror(errno)));
return false;
}