You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -98,6 +98,9 @@ namespace System.IO {
|
||||
if (!isFullyQualified && !isInvalidPath)
|
||||
return path;
|
||||
|
||||
#if DISABLE_CAS_USE
|
||||
bool safeToReturn = !isInvalidPath;
|
||||
#else
|
||||
bool safeToReturn = false;
|
||||
try {
|
||||
if (!isInvalidPath) {
|
||||
@@ -118,7 +121,7 @@ namespace System.IO {
|
||||
// from Security.Util.StringExpressionSet.CanonicalizePath when ':' is found in the path
|
||||
// beyond string index position 1.
|
||||
}
|
||||
|
||||
#endif // DISABLE_CAS_USE
|
||||
if (!safeToReturn) {
|
||||
if (Path.IsDirectorySeparator(path[path.Length - 1]))
|
||||
path = Environment.GetResourceString("IO.IO_NoPermissionToDirectoryName");
|
||||
|
||||
@@ -185,6 +185,9 @@ namespace System.IO {
|
||||
internal static String FormatFileLoadExceptionMessage(String fileName,
|
||||
int hResult)
|
||||
{
|
||||
#if MONO
|
||||
return string.Format (CultureInfo.InvariantCulture, "Could not load file or assembly '{0}' or one of its dependencies", fileName);
|
||||
#else
|
||||
string format = null;
|
||||
GetFileLoadExceptionMessage(hResult, JitHelpers.GetStringHandleOnStack(ref format));
|
||||
|
||||
@@ -192,8 +195,9 @@ namespace System.IO {
|
||||
GetMessageForHR(hResult, JitHelpers.GetStringHandleOnStack(ref message));
|
||||
|
||||
return String.Format(CultureInfo.CurrentCulture, format, fileName, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
@@ -205,5 +209,6 @@ namespace System.IO {
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern void GetMessageForHR(int hresult, StringHandleOnStack retString);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Threading;
|
||||
using System.Diagnostics.Contracts;
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
using System.Threading.Tasks;
|
||||
#endif // !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace System.IO {
|
||||
private long _offset;
|
||||
private FileAccess _access;
|
||||
internal bool _isOpen;
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[NonSerialized]
|
||||
private Task<Int32> _lastReadTask; // The last successful task returned from ReadAsync
|
||||
#endif // FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
@@ -163,11 +163,13 @@ namespace System.IO {
|
||||
if (_isOpen) {
|
||||
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
|
||||
}
|
||||
#if !DISABLE_CAS_USE
|
||||
if (!skipSecurityCheck) {
|
||||
#pragma warning disable 618
|
||||
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
|
||||
#pragma warning restore 618
|
||||
}
|
||||
#endif
|
||||
|
||||
// check for wraparound
|
||||
unsafe {
|
||||
@@ -242,11 +244,12 @@ namespace System.IO {
|
||||
if (_isOpen)
|
||||
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
|
||||
|
||||
#if !DISABLE_CAS_USE
|
||||
if (!skipSecurityCheck)
|
||||
#pragma warning disable 618
|
||||
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
|
||||
#pragma warning restore 618
|
||||
|
||||
#endif
|
||||
_mem = pointer;
|
||||
_offset = 0;
|
||||
_length = length;
|
||||
@@ -295,7 +298,7 @@ namespace System.IO {
|
||||
if (!_isOpen) __Error.StreamIsClosed();
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading=true)]
|
||||
[ComVisible(false)]
|
||||
public override Task FlushAsync(CancellationToken cancellationToken) {
|
||||
@@ -457,7 +460,7 @@ namespace System.IO {
|
||||
return nInt;
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading = true)]
|
||||
[ComVisible(false)]
|
||||
public override Task<Int32> ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
|
||||
@@ -653,7 +656,7 @@ namespace System.IO {
|
||||
return;
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading = true)]
|
||||
[ComVisible(false)]
|
||||
public override Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
|
||||
|
||||
Reference in New Issue
Block a user