4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-09 02:29:07 +08:00

Cygwin: Make sure newer apps get uname_x even when loading uname dynamically

if an application built after API version 334 loads uname dynamically,
it actually gets the old uname, rather than the new uname_x.  Fix this by
checking the apps API version in uname and call uname_x instead, if it's
a newer app.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2020-12-14 12:29:23 +01:00 committed by Ken Brown
parent a79198c251
commit d1108f42e4
2 changed files with 10 additions and 0 deletions

View File

@ -74,6 +74,9 @@ details. */
#define CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS \ #define CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS \
(CYGWIN_VERSION_USER_API_VERSION_COMBINED >= 272) (CYGWIN_VERSION_USER_API_VERSION_COMBINED >= 272)
#define CYGWIN_VERSION_CHECK_FOR_UNAME_X \
(CYGWIN_VERSION_USER_API_VERSION_COMBINED >= 335)
#define CYGWIN_VERSION_CYGWIN_CONV 181 #define CYGWIN_VERSION_CYGWIN_CONV 181
/* API_MAJOR 0.0: Initial version. API_MINOR changes: /* API_MAJOR 0.0: Initial version. API_MINOR changes:

View File

@ -92,7 +92,14 @@ struct old_utsname
extern "C" int extern "C" int
uname (struct utsname *in_name) uname (struct utsname *in_name)
{ {
/* This occurs if the application fetches the uname symbol dynamically.
We must call uname_x for newer API versions, otherwise the idea of
struct utsname doesn't match. */
if (CYGWIN_VERSION_CHECK_FOR_UNAME_X)
return uname_x (in_name);
struct old_utsname *name = (struct old_utsname *) in_name; struct old_utsname *name = (struct old_utsname *) in_name;
__try __try
{ {
char *snp = strstr (cygwin_version.dll_build_date, "SNP"); char *snp = strstr (cygwin_version.dll_build_date, "SNP");