mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
Scripting: improved write permission checks
This commit is contained in:
parent
322c996afe
commit
77ed3d4733
@ -1386,6 +1386,7 @@ u32 DumpCxiSrlFromTmdFile(const char* path) {
|
||||
// prepare output name
|
||||
snprintf(dest, 256, OUTPUT_PATH "/");
|
||||
char* dname = dest + strnlen(dest, 256);
|
||||
if (!CheckWritePermissions(dest)) return 1;
|
||||
|
||||
// ensure the output dir exists
|
||||
if (fvx_rmkdir(OUTPUT_PATH) != FR_OK)
|
||||
@ -1426,6 +1427,7 @@ u32 ExtractCodeFromCxiFile(const char* path, const char* path_out) {
|
||||
if (fvx_rmkdir(OUTPUT_PATH) != FR_OK) return 1;
|
||||
snprintf(dest, 256, OUTPUT_PATH "/%016llX%s%s", ncch.programId, (exthdr.flag & 0x1) ? ".dec" : "", EXEFS_CODE_NAME);
|
||||
} else strncpy(dest, path_out, 256);
|
||||
if (!CheckWritePermissions(dest)) return 1;
|
||||
|
||||
// write output file
|
||||
fvx_unlink(dest);
|
||||
|
@ -527,7 +527,7 @@ bool run_cmd(cmd_id id, u32 flags, char** argv, char* err_str) {
|
||||
ret = PathDelete(argv[0]);
|
||||
if (err_str) snprintf(err_str, _ERR_STR_LEN, "remove fail");
|
||||
} else if (id == CMD_ID_MKDIR) {
|
||||
ret = (fvx_rmkdir(argv[0]) == FR_OK);
|
||||
ret = (CheckWritePermissions(argv[0])) && (fvx_rmkdir(argv[0]) == FR_OK);
|
||||
if (err_str) snprintf(err_str, _ERR_STR_LEN, "makedir fail");
|
||||
} else if (id == CMD_ID_MOUNT) {
|
||||
ret = InitImgFS(argv[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user