From ac52c3f2057562cd2e43011e6be32e1d79f7c6f2 Mon Sep 17 00:00:00 2001
From: Peter Limkilde Svendsen <peter.limkilde@gmail.com>
Date: Tue, 26 May 2020 17:58:59 +0200
Subject: [PATCH] Replace mem::uninitialized()

---
 src/header/time/mod.rs | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/header/time/mod.rs b/src/header/time/mod.rs
index 7c17155a..b5c7aa2d 100644
--- a/src/header/time/mod.rs
+++ b/src/header/time/mod.rs
@@ -141,9 +141,22 @@ pub unsafe extern "C" fn ctime(clock: *const time_t) -> *mut c_char {
 
 #[no_mangle]
 pub unsafe extern "C" fn ctime_r(clock: *const time_t, buf: *mut c_char) -> *mut c_char {
-    let mut tm1: tm = core::mem::uninitialized();
+    // Using MaybeUninit<tm> seems to cause a panic during the build process
+    let mut tm1 = tm {
+        tm_sec: 0,
+        tm_min: 0,
+        tm_hour: 0,
+        tm_mday: 0,
+        tm_mon: 0,
+        tm_year: 0,
+        tm_wday: 0,
+        tm_yday: 0,
+        tm_isdst: 0,
+        tm_gmtoff: 0,
+        tm_zone: core::ptr::null_mut(),
+    };
     localtime_r(clock, &mut tm1);
-    asctime_r(&mut tm1, buf)
+    asctime_r(&tm1, buf)
 }
 
 #[no_mangle]
-- 
GitLab