summary refs log tree commit diff
path: root/archive.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-10 11:33:04 -0400
committerJune McEnroe <june@causal.agency>2020-04-10 11:33:04 -0400
commit5d2ea6d9d60a64579eb801a8e46ce7b65d1fbd1f (patch)
treea375f50c9594ba2ebb6195ab83a4845d817b764e /archive.c
parentUse UIDNEXT to avoid asking IMAP to do any work (diff)
downloadbubger-5d2ea6d9d60a64579eb801a8e46ce7b65d1fbd1f.tar.gz
bubger-5d2ea6d9d60a64579eb801a8e46ce7b65d1fbd1f.zip
Link mbox files into message/
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);
 		}