(mailbox_create): Bugfix. Return failure if the folder cannot be created.
Showing
1 changed file
with
7 additions
and
15 deletions
... | @@ -109,23 +109,15 @@ mailbox_create (mailbox_t *pmbox, const char *name) | ... | @@ -109,23 +109,15 @@ mailbox_create (mailbox_t *pmbox, const char *name) |
109 | 109 | ||
110 | /* Create the folder before initializing the concrete mailbox. | 110 | /* Create the folder before initializing the concrete mailbox. |
111 | The mailbox needs it's back pointer. */ | 111 | The mailbox needs it's back pointer. */ |
112 | { | 112 | status = folder_create (&mbox->folder, name); |
113 | folder_t folder; | 113 | |
114 | if (folder_create (&folder, name) == 0) | 114 | if (status == 0) |
115 | mbox->folder = folder; | 115 | status = m_init (mbox); /* Create the concrete mailbox type. */ |
116 | } | 116 | |
117 | |||
118 | /* Create the concrete mailbox type. */ | ||
119 | status = m_init (mbox); | ||
120 | if (status != 0) | 117 | if (status != 0) |
121 | { | 118 | mailbox_destroy (&mbox); |
122 | mailbox_destroy (&mbox); | ||
123 | } | ||
124 | else | 119 | else |
125 | { | 120 | *pmbox = mbox; |
126 | *pmbox = mbox; | ||
127 | } | ||
128 | |||
129 | } | 121 | } |
130 | else | 122 | else |
131 | status = MU_ERR_NO_HANDLER; | 123 | status = MU_ERR_NO_HANDLER; | ... | ... |
-
Please register or sign in to post a comment