libremail+tools: Add mailbox_create() function
It is best to prefer mailbox_create() rather than try_mkdir() directly as we'll be able to encapslate mailbox creation logic within it. Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <dirent.h>
|
||||
#include "libremail/file.h"
|
||||
#include "libremail/common.h"
|
||||
#include "libremail/mailbox.h"
|
||||
|
||||
/* Maximum command components */
|
||||
#define CMD_MAX_CNP 6
|
||||
@@ -120,7 +121,7 @@ cmd_mailbox_create(const char *cmdlist[CMD_MAX_CNP], size_t count)
|
||||
MAILBOX_PREFIX, cmdlist[2]);
|
||||
|
||||
/* Create the mailbox */
|
||||
if (try_mkdir(pathbuf, DEFAULT_MAILBOX_MODE) < 0) {
|
||||
if (mailbox_create(pathbuf, DEFAULT_MAILBOX_MODE) < 0) {
|
||||
printf("fatal: failed to create mailbox\n");
|
||||
perror("try_mkdir");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user