summary refs log tree commit diff
path: root/archive.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--archive.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/archive.c b/archive.c
index 97bb99a..350fdfa 100644
--- a/archive.c
+++ b/archive.c
@@ -47,6 +47,11 @@ static void uidWrite(const char *path, uint32_t uid) {
 	if (error) err(EX_IOERR, "%s", path);
 }
 
+static void createDir(const char *path) {
+	int error = mkdir(path, 0775);
+	if (error && errno != EEXIST) err(EX_CANTCREAT, "%s", path);
+}
+
 int main(int argc, char *argv[]) {
 	const char *host = NULL;
 	const char *port = "imaps";
@@ -166,8 +171,8 @@ int main(int argc, char *argv[]) {
 			if (!resp.data.len) {
 				errx(EX_TEMPFAIL, "no messages matching %s", search);
 			}
-			int error = mkdir("UID", 0775);
-			if (error && errno != EEXIST) err(EX_CANTCREAT, "UID");
+			createDir("UID");
+			createDir("message");
 			export = exportThreads(imap, resp.data);
 		}