Skip to content

Commit

Permalink
Change back permissions to 0x666
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpl0itU committed Nov 2, 2022
1 parent a1e05da commit 84da419
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/savemng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ static bool createFolder(const char *fPath) { //Adapted from mkdir_p made by Jon
if (found > 2) {
*p = '\0';
if (checkEntry(_path.c_str()) == 0) {
if (mkdir(_path.c_str(), 0x660) == -1)
if (mkdir(_path.c_str(), 0x666) == -1)
return false;
FSAChangeMode(handle, _path.c_str(), (FSMode) 0x660);
FSAChangeMode(handle, _path.c_str(), (FSMode) 0x666);
}

*p = '/';
Expand All @@ -190,9 +190,9 @@ static bool createFolder(const char *fPath) { //Adapted from mkdir_p made by Jon
}

if (checkEntry(_path.c_str()) == 0)
if (mkdir(_path.c_str(), 0x660) == -1)
if (mkdir(_path.c_str(), 0x666) == -1)
return false;
FSAChangeMode(handle, _path.c_str(), (FSMode) 0x660);
FSAChangeMode(handle, _path.c_str(), (FSMode) 0x666);

return true;
}
Expand Down Expand Up @@ -505,7 +505,7 @@ static bool copyFile(std::string pPath, std::string oPath) {
fclose(source);
fclose(dest);

FSAChangeMode(handle, oPath.c_str(), (FSMode) 0x660);
FSAChangeMode(handle, oPath.c_str(), (FSMode) 0x666);

return true;
}
Expand All @@ -515,8 +515,8 @@ static int copyDir(std::string pPath, std::string tPath) { // Source: ft2sd
if (dir == nullptr)
return -1;

mkdir(tPath.c_str(), 0x660);
FSAChangeMode(handle, tPath.c_str(), (FSMode) 0x660);
mkdir(tPath.c_str(), 0x666);
FSAChangeMode(handle, tPath.c_str(), (FSMode) 0x666);
auto *data = (dirent *) malloc(sizeof(dirent));

while ((data = readdir(dir)) != nullptr) {
Expand All @@ -528,8 +528,8 @@ static int copyDir(std::string pPath, std::string tPath) { // Source: ft2sd
std::string targetPath = stringFormat("%s/%s", tPath.c_str(), data->d_name);

if ((data->d_type & DT_DIR) != 0) {
mkdir(targetPath.c_str(), 0x660);
FSAChangeMode(handle, targetPath.c_str(), (FSMode) 0x660);
mkdir(targetPath.c_str(), 0x666);
FSAChangeMode(handle, targetPath.c_str(), (FSMode) 0x666);
if (copyDir(pPath + stringFormat("/%s", data->d_name), targetPath) != 0) {
closedir(dir);
return -2;
Expand Down

0 comments on commit 84da419

Please sign in to comment.