Commit d164254b d164254b12816149866b076cab4cd10f4a2ba3c4 by Sergey Poznyakoff

(amd_open): Create directory if MU_STREAM_CREAT is given.

1 parent 956a3c65
......@@ -332,7 +332,17 @@ amd_open (mu_mailbox_t mailbox, int flags)
mailbox->flags = flags;
if (stat (amd->name, &st) < 0)
{
if ((flags & MU_STREAM_CREAT) && errno == ENOENT)
{
if (mkdir (amd->name, S_IRUSR|S_IWUSR|S_IXUSR))
return errno;
if (stat (amd->name, &st) < 0)
return errno;
}
else
return errno;
}
if (!S_ISDIR (st.st_mode))
return EINVAL;
......