memset(buf, 0x00, sizeof(buf));
SNPRINTF(buf, sizeof(buf), "%s%s", prefix_path, EMAIL_PATH);
- mkdir(buf, DIRECTORY_PERMISSION);
+ if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
memset(buf, 0x00, sizeof(buf));
SNPRINTF(buf, sizeof(buf), "%s%s", prefix_path, MAIL_HOME);
- mkdir(buf, DIRECTORY_PERMISSION);
+ if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
memset(buf, 0x00, sizeof(buf));
SNPRINTF(buf, sizeof(buf), "%s%s", prefix_path, MAIL_TEMP);
- mkdir(buf, DIRECTORY_PERMISSION);
+ if (mkdir(buf, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed [%s]", buf);
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
_delete_temp_file(buf);
EM_SAFE_FREE(prefix_path);
} else {
- if (mkdir(DATA_PATH, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
- if (mkdir(EMAIL_PATH, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
- if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
- if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(DATA_PATH, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
+ if (mkdir(EMAIL_PATH, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
+ if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
+ if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
_delete_temp_file(MAIL_TEMP);
}
goto FINISH_OFF;
}
- if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
- if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0)
- EM_DEBUG_EXCEPTION("Fail to create the directory \n");
+ if (mkdir(MAIL_HOME, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
+ if (mkdir(MAIL_TEMP, DIRECTORY_PERMISSION) != 0) {
+ EM_DEBUG_EXCEPTION(" mkdir failed ");
+ error = EMAIL_ERROR_SYSTEM_FAILURE;
+ if (errno == 28)
+ error = EMAIL_ERROR_OUT_OF_MEMORY;
+ goto FINISH_OFF;
+ }
if (chmod(MAIL_TEMP, 0777) != 0)
EM_DEBUG_EXCEPTION("Fail to change the permission \n");