Skip to content

Commit

Permalink
remove disposable object from method
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-erojaslizano committed Jul 29, 2024
1 parent 65f15f9 commit 58c4cd3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Snowflake.Data/Configuration/EasyLoggingConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ private string TryToReadFile(string filePath)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
using var streamReader = new StreamReader(filePath, Encoding.Default);
var streamReader = new StreamReader(filePath, Encoding.Default);
return streamReader.ReadToEnd();

Check warning on line 59 in Snowflake.Data/Configuration/EasyLoggingConfigParser.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Configuration/EasyLoggingConfigParser.cs#L57-L59

Added lines #L57 - L59 were not covered by tests
}
else
{
var handle = VerifyUnixPermissions(filePath);

using var streamReader = new StreamReader(handle, Encoding.Default);
var streamReader = new StreamReader(handle, Encoding.Default);
return streamReader.ReadToEnd();
}
}
Expand All @@ -79,7 +79,7 @@ private static UnixStream VerifyUnixPermissions(string filePath)
FileAccessPermissions forbiddenPermissions = FileAccessPermissions.OtherWrite | FileAccessPermissions.GroupWrite;
var fileInfo = new UnixFileInfo(path: filePath);

using var handle = fileInfo.OpenRead();
var handle = fileInfo.OpenRead();
if (handle.OwnerUser.UserId != Syscall.geteuid())
throw new SnowflakeDbException(SFError.INTERNAL_ERROR, "Attempting to read a file not owned by the effective user of the current process");

Check warning on line 84 in Snowflake.Data/Configuration/EasyLoggingConfigParser.cs

View check run for this annotation

Codecov / codecov/patch

Snowflake.Data/Configuration/EasyLoggingConfigParser.cs#L84

Added line #L84 was not covered by tests
if (handle.OwnerGroup.GroupId != Syscall.getegid())
Expand Down

0 comments on commit 58c4cd3

Please sign in to comment.