From: Oliver Kurth Date: Mon, 23 Oct 2017 21:21:22 +0000 (-0700) Subject: Porting some common code to another architecture; not applicable to X-Git-Tag: stable-10.3.0~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff6daf51be641a805f94fa11415e032bad3ef48a;p=thirdparty%2Fopen-vm-tools.git Porting some common code to another architecture; not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/include/posix.h b/open-vm-tools/lib/include/posix.h index 664f85836..c5a933364 100644 --- a/open-vm-tools/lib/include/posix.h +++ b/open-vm-tools/lib/include/posix.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2017 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -189,6 +189,7 @@ int Posix_Getpwnam_r(const char *name, struct passwd *pw, int Posix_Getpwuid_r(uid_t uid, struct passwd *pw, char *buf, size_t size, struct passwd **ppw); struct passwd *Posix_Getpwent(void); +void Posix_Endpwent(void); struct group *Posix_Getgrnam(const char *name); int Posix_Getgrnam_r(const char *name, struct group *gr, char *buf, size_t size, struct group **pgr); diff --git a/open-vm-tools/lib/misc/posixPwd.c b/open-vm-tools/lib/misc/posixPwd.c index 483f8f034..e281ae17a 100644 --- a/open-vm-tools/lib/misc/posixPwd.c +++ b/open-vm-tools/lib/misc/posixPwd.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2017 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -236,6 +236,39 @@ Posix_Getpwent(void) #endif } + +/* + *---------------------------------------------------------------------- + * + * Posix_Endpwent -- + * + * POSIX endpwent() + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +Posix_Endpwent(void) +{ +#if defined(__ANDROID__) + /* + * endpwent() not avail until Android O + * TODO: When Android O(Oreo) becomes mainstream, we can remove this #if + * Refer https://github.com/android-ndk/ndk/issues/77 + */ + return; +#else + endpwent(); +#endif +} + + #if !defined(VM_SYSTEM_HAS_GETPWNAM_R) || \ !defined(VM_SYSTEM_HAS_GETPWUID_R) || \ !defined(VM_SYSTEM_HAS_GETGRNAM_R) // { diff --git a/open-vm-tools/lib/misc/util_misc.c b/open-vm-tools/lib/misc/util_misc.c index b1d257d48..78667f654 100644 --- a/open-vm-tools/lib/misc/util_misc.c +++ b/open-vm-tools/lib/misc/util_misc.c @@ -508,7 +508,7 @@ UtilDoTildeSubst(const char *user) // IN: name of user } if (str == NULL && pwd != NULL) { str = UtilGetHomeDirectory(pwd); - endpwent(); + Posix_Endpwent(); if (str == NULL) { Log("Could not get home directory for user.\n"); } @@ -673,7 +673,7 @@ Util_ExpandString(const char *fileName) // IN file path to expand #if !defined(_WIN32) struct passwd *pwd = Posix_Getpwuid(getuid()); expand = UtilGetLoginName(pwd); - endpwent(); + Posix_Endpwent(); #else DWORD n = ARRAYSIZE(bufW); if (GetUserNameW(bufW, &n)) { diff --git a/open-vm-tools/lib/misc/vthreadBase.c b/open-vm-tools/lib/misc/vthreadBase.c index 78d65b0fa..fa5169ba4 100644 --- a/open-vm-tools/lib/misc/vthreadBase.c +++ b/open-vm-tools/lib/misc/vthreadBase.c @@ -301,7 +301,7 @@ VThreadBase_CurID(void) *----------------------------------------------------------------------------- */ -#ifdef __linux__ +#if defined(__linux__) && !defined(__ANDROID__) static pid_t vmw_pthread_getthreadid_np(void) { @@ -562,6 +562,10 @@ VThreadBase_SetNamePrefix(const char *prefix) // IN: name prefix void VThreadBase_ForgetSelf(void) { +#if !defined VMW_HAVE_TLS + char *buf; +#endif + if (vmx86_debug) { Log("Forgetting VThreadID %" FMTPD "d (\"%s\").\n", VThread_CurID(), VThread_CurName()); @@ -574,8 +578,6 @@ VThreadBase_ForgetSelf(void) #if defined VMW_HAVE_TLS memset(vthreadName, '\0', sizeof vthreadName); #else - char *buf; - ASSERT(vthreadNameKey != 0); ASSERT(!VThreadBase_IsInSignal()); diff --git a/open-vm-tools/lib/panic/panic.c b/open-vm-tools/lib/panic/panic.c index b86340491..c739842d5 100644 --- a/open-vm-tools/lib/panic/panic.c +++ b/open-vm-tools/lib/panic/panic.c @@ -602,7 +602,7 @@ Panic_Panic(const char *format, Panic_DumpGuiResources(); -#if defined(_WIN32) || !defined(VMX86_TOOLS) +#if (defined(_WIN32) || !defined(VMX86_TOOLS)) && !defined(__ANDROID__) if (Panic_GetCoreDumpOnPanic()) { CoreDump_CoreDump(); }