Skip to content

Commit

Permalink
Merge branch 'fix/permissions-after-unpack' of github.com:nzbgetcom/n…
Browse files Browse the repository at this point in the history
…zbget into feature/test-fix-permissions
  • Loading branch information
phnzb committed Apr 11, 2024
2 parents 5103801 + b40a80a commit 9726010
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions daemon/util/FileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,15 +961,19 @@ void FileSystem::FixExecPermission(const char* filename)

void FileSystem::SetFilePermissionsWithUmask(const char* filename, mode_t umask)
{
mode_t permissions = buffer.st_mode & ~umask;
info("%s %o %s %s", "Setting permissons ", permissions, "on", filename);
if (!chmod(filename, permissions))
{
info("%s", "Success");
}
else
struct stat buffer;
if (!stat(filename, &buffer))
{
error("%s", "Failure");
mode_t permissions = buffer.st_mode & ~umask;
info("%s %o %s %s", "Setting permissons ", permissions, "on", filename);
if (!chmod(filename, permissions))
{
info("%s", "Success");
}
else
{
error("%s", "Failure");
}
}
}
#endif
Expand Down

0 comments on commit 9726010

Please sign in to comment.