Skip to content

Commit

Permalink
change variable name hasPermissions
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-erojaslizano committed May 16, 2024
1 parent dc4f5b0 commit 9a2925b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Snowflake.Data/Configuration/EasyLoggingConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,17 @@ private void CheckIfValidPermissions(FileStream fileStream, string filePath)

#if NET8_0_OR_GREATER
var unixFileMode = File.GetUnixFileMode(fileStream.SafeFileHandle);
var hasPermissions = !(((UnixFileMode.GroupWrite | UnixFileMode.OtherWrite) & unixFileMode) != 0);
var hasGroupOrOtherWritePermissions = (((UnixFileMode.GroupWrite | UnixFileMode.OtherWrite) & unixFileMode) != 0);
#else
var entitlements = FileAccessPermissions.GroupWrite | FileAccessPermissions.OtherWrite;
var hasPermissions = !_unixOperations.CheckFileHasAnyOfPermissions(filePath, entitlements);
var hasGroupOrOtherWritePermissions = _unixOperations.CheckFileHasAnyOfPermissions(filePath, entitlements);
#endif
if (hasPermissions)
if (hasGroupOrOtherWritePermissions)
{
return;
var errorMessage = $"Error due to other users having permission to modify the config file: {filePath}";
s_logger.Error(errorMessage);
throw new Exception(errorMessage);
}

var errorMessage = $"Error due to other users having permission to modify the config file: {filePath}";
s_logger.Error(errorMessage);
throw new Exception(errorMessage);
}
}
}

0 comments on commit 9a2925b

Please sign in to comment.