From 29fa29f41bf68cbdf6809ec7449ca09a6b8da2fe Mon Sep 17 00:00:00 2001 From: Steven Lizano Date: Thu, 16 May 2024 14:28:52 -0600 Subject: [PATCH] change variable name hasPermissions --- .../Configuration/EasyLoggingConfigParser.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs b/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs index b247037ba..c1d75ee72 100644 --- a/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs +++ b/Snowflake.Data/Configuration/EasyLoggingConfigParser.cs @@ -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); } } }