wut/libraries/wutdevoptab/devoptab_fs_mkdir.c

33 lines
609 B
C
Raw Normal View History

#include "devoptab_fs.h"
2018-05-27 12:11:45 +01:00
int
__wut_fs_mkdir(struct _reent *r,
const char *path,
int mode)
{
FSError status;
FSCmdBlock cmd;
char *fixedPath;
2018-05-27 12:11:45 +01:00
if (!path) {
r->_errno = EINVAL;
2018-05-27 12:11:45 +01:00
return -1;
}
fixedPath = __wut_fs_fixpath(r, path);
if (!fixedPath) {
2018-05-27 12:11:45 +01:00
return -1;
}
// TODO: Use mode to set directory attributes.
FSInitCmdBlock(&cmd);
status = FSMakeDir(__wut_devoptab_fs_client, &cmd, fixedPath, -1);
free(fixedPath);
if (status < 0) {
r->_errno = __wut_fs_translate_error(status);
2018-05-27 12:11:45 +01:00
return -1;
}
return 0;
2018-05-27 12:11:45 +01:00
}