mirror of
https://github.com/Ryuzaki-MrL/savemii.git
synced 2026-04-26 00:06:11 -05:00
Fix chmod
This commit is contained in:
parent
ec2ec32fe7
commit
1ac27ec460
|
|
@ -9,6 +9,29 @@ int
|
|||
__extusb_fs_chmod(struct _reent *r,
|
||||
const char *path,
|
||||
mode_t mode) {
|
||||
if (!path) {
|
||||
r->_errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *fixedPath = __extusb_fs_fixpath(r, path);
|
||||
if (!fixedPath) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
FRESULT fr;
|
||||
if (((mode & S_IWUSR) || (mode & S_IWGRP) || (mode & S_IWOTH)) == 0) {
|
||||
fr = f_chmod(fixedPath, 0, AM_RDO);
|
||||
} else {
|
||||
fr = f_chmod(fixedPath, AM_RDO, AM_RDO);
|
||||
}
|
||||
|
||||
free(fixedPath);
|
||||
if (fr != FR_OK) {
|
||||
r->_errno = __extusb_fs_translate_error(fr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
/* This option switches f_expand function. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_CHMOD 0
|
||||
#define FF_USE_CHMOD 1
|
||||
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
|
||||
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
|
@ -235,7 +235,7 @@
|
|||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define FF_FS_EXFAT 1
|
||||
#define FF_FS_EXFAT 0
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <future>
|
||||
#include <language.h>
|
||||
#include <savemng.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "fatfs/extusb_devoptab/extusb_devoptab.h"
|
||||
|
||||
|
|
@ -18,7 +19,6 @@ Account *sdacc;
|
|||
uint8_t wiiuaccn = 0, sdaccn = 5;
|
||||
|
||||
extern "C" FSClient *__wut_devoptab_fs_client;
|
||||
static FSCmdBlock cmdBlk;
|
||||
|
||||
std::string usb;
|
||||
|
||||
|
|
@ -45,8 +45,6 @@ int checkEntry(const char *fPath) {
|
|||
|
||||
bool initFS() {
|
||||
FSInit();
|
||||
FSInitCmdBlock(&cmdBlk);
|
||||
FSSetCmdPriority(&cmdBlk, 0);
|
||||
bool ret = Mocha_InitLibrary() == MOCHA_RESULT_SUCCESS;
|
||||
if (ret)
|
||||
ret = Mocha_UnlockFSClient(__wut_devoptab_fs_client) == MOCHA_RESULT_SUCCESS;
|
||||
|
|
@ -497,7 +495,7 @@ static bool copyFile(std::string pPath, std::string oPath) {
|
|||
|
||||
copyFileThreaded(source, dest, sizef);
|
||||
|
||||
FSChangeMode(__wut_devoptab_fs_client, &cmdBlk, (char *) oPath.c_str(), (FSMode) 0x666, (FSMode) 0x777, FS_ERROR_FLAG_ALL);
|
||||
chmod(oPath.c_str(), 0x666);
|
||||
|
||||
fclose(source);
|
||||
fclose(dest);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user