File tree Expand file tree Collapse file tree
src/System.Management.Automation/CoreCLR Expand file tree Collapse file tree Original file line number Diff line number Diff line change 185185 <DebugType >full</DebugType >
186186 </PropertyGroup >
187187
188- <!-- Define non-windows, release configuration properties -->
189- <PropertyGroup Condition =" '$(Configuration)' == 'Release' And '$(IsWindows)' != 'true' " >
190- <!-- Set-Date fails with optimize enabled in NonWindowsSetDate
191- Debugging the issues resolves the problem
192- -->
193- <Optimize >false</Optimize >
194- </PropertyGroup >
195-
196188 <PropertyGroup >
197189 <Features >strict</Features >
198190 </PropertyGroup >
Original file line number Diff line number Diff line change @@ -932,8 +932,10 @@ internal static partial class NativeMethods
932932 [ LibraryImport ( psLib ) ]
933933 internal static partial int WaitPid ( int pid , [ MarshalAs ( UnmanagedType . Bool ) ] bool nohang ) ;
934934
935- // This is a struct tm from <time.h>.
936- [ StructLayout ( LayoutKind . Sequential ) ]
935+ // This is the struct `private_tm` from setdate.h in libpsl-native.
936+ // Packing is set to 4 to match the unmanaged declaration.
937+ // https://github.com/PowerShell/PowerShell-Native/blob/c5575ceb064e60355b9fee33eabae6c6d2708d14/src/libpsl-native/src/setdate.h#L23
938+ [ StructLayout ( LayoutKind . Sequential , Pack = 4 ) ]
937939 internal unsafe struct UnixTm
938940 {
939941 /// <summary>Seconds (0-60).</summary>
@@ -980,7 +982,7 @@ internal static UnixTm DateTimeToUnixTm(DateTime date)
980982 return tm ;
981983 }
982984
983- [ LibraryImport ( psLib ) ]
985+ [ LibraryImport ( psLib , SetLastError = true ) ]
984986 internal static unsafe partial int SetDate ( UnixTm * tm ) ;
985987
986988 [ LibraryImport ( psLib , StringMarshalling = StringMarshalling . Utf8 ) ]
You can’t perform that action at this time.
0 commit comments