mirror of
https://github.com/wiiu-env/wut.git
synced 2024-12-13 21:51:53 +01:00
30 lines
540 B
C
30 lines
540 B
C
|
#include "devoptab_fs.h"
|
||
|
|
||
|
int
|
||
|
__wut_fs_chmod(struct _reent *r,
|
||
|
const char *path,
|
||
|
mode_t mode)
|
||
|
{
|
||
|
FSStatus rc;
|
||
|
char *path_fix = __wut_fs_fixpath(r, path);
|
||
|
|
||
|
if (!path_fix) {
|
||
|
r->_errno = ENOMEM;
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
// Set up command block
|
||
|
FSCmdBlock fsCmd;
|
||
|
FSInitCmdBlock(&fsCmd);
|
||
|
|
||
|
rc = FSChangeMode(__wut_devoptab_fs_client, &fsCmd, path_fix, (FSMode)mode, -1);
|
||
|
free(path_fix);
|
||
|
|
||
|
if (rc >= 0) {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
r->_errno = __wut_fs_translate_error(rc);
|
||
|
return -1;
|
||
|
}
|