|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
#
|
|
# Filename: package/.../musl/0001-restore-h_errno-ABI-compatibility-with-ancient-binar.patch
|
|
# Copyright (C) 2020 The OpenSDE Project
|
|
#
|
|
# More information can be found in the files COPYING and README.
|
|
#
|
|
# This patch file is dual-licensed. It is available under the license the
|
|
# patched project is licensed under, as long as it is an OpenSource license
|
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
# of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
|
|
From cf27184d00c1588eccac71a3bc89c9798e60bbd9 Mon Sep 17 00:00:00 2001
|
|
From: Rich Felker <dalias@aerifal.cx>
|
|
Date: Sun, 30 Aug 2020 21:30:37 -0400
|
|
Subject: [PATCH] restore h_errno ABI compatibility with ancient binaries
|
|
|
|
prior to commit e68c51ac46a9f273927aef8dcebc89912ab19ece, h_errno was
|
|
actually an external data object not a macro. bring back the symbol,
|
|
and use it as the storage for the main thread's h_errno.
|
|
|
|
technically this still doesn't provide full compatibility if the
|
|
application was multithreaded, but at the time there were no res_*
|
|
functions (and they did not set h_errno anyway), so any use of h_errno
|
|
would have been via thread-unsafe functions. thus a solution that just
|
|
fixes single-threaded applications seems acceptable.
|
|
---
|
|
src/network/h_errno.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/src/network/h_errno.c b/src/network/h_errno.c
|
|
index 8677a92b..638f7718 100644
|
|
--- a/src/network/h_errno.c
|
|
+++ b/src/network/h_errno.c
|
|
@@ -1,7 +1,11 @@
|
|
#include <netdb.h>
|
|
#include "pthread_impl.h"
|
|
|
|
+#undef h_errno
|
|
+int h_errno;
|
|
+
|
|
int *__h_errno_location(void)
|
|
{
|
|
+ if (!__pthread_self()->stack) return &h_errno;
|
|
return &__pthread_self()->h_errno_val;
|
|
}
|
|
--
|
|
2.28.0
|
|
|