* localtime.c (tzset): Set errno if the lock fails.
This should never happen, but if it does the least we can
do is set errno, as other functions do.
---
 localtime.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/localtime.c b/localtime.c
index 54db0ab7..ef094560 100644
--- a/localtime.c
+++ b/localtime.c
@@ -1788,8 +1788,11 @@ void
 tzset(void)
 {
   monotime_t now = get_monotonic_time();
-  if (lock() != 0)
+  int err = lock();
+  if (err != 0) {
+    errno = err;
     return;
+  }
   tzset_unlocked(now);
   unlock();
 }
-- 
2.51.0

Reply via email to