protected internal static FSDataInputStream ForceSecureOpenFSDataInputStream(FilePath file, string expectedOwner, string expectedGroup) { FSDataInputStream @in = rawFilesystem.Open(new Path(file.GetAbsolutePath())); bool success = false; try { NativeIO.POSIX.Stat stat = NativeIO.POSIX.GetFstat(@in.GetFileDescriptor()); CheckStat(file, stat.GetOwner(), stat.GetGroup(), expectedOwner, expectedGroup); success = true; return(@in); } finally { if (!success) { @in.Close(); } } }