30 lines
451 B
C
30 lines
451 B
C
|
|
/*
|
||
|
|
* Copyright (c) 2026, Chloe Moffett
|
||
|
|
* Provided under the BSD-3 clause
|
||
|
|
*/
|
||
|
|
|
||
|
|
#include <stdint.h>
|
||
|
|
#include <stdio.h>
|
||
|
|
#include <stddef.h>
|
||
|
|
#include <errno.h>
|
||
|
|
#include "libremail/mailbox.h"
|
||
|
|
|
||
|
|
int
|
||
|
|
mailbox_create(const char *path, mode_t mode)
|
||
|
|
{
|
||
|
|
int error;
|
||
|
|
|
||
|
|
if (path == NULL) {
|
||
|
|
errno = EINVAL;
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
error = mkdir(path, mode);
|
||
|
|
if (error < 0) {
|
||
|
|
perror("mkdir");
|
||
|
|
return -1;
|
||
|
|
}
|
||
|
|
|
||
|
|
return 0;
|
||
|
|
}
|