]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Porting some common code to another architecture; not applicable to
authorOliver Kurth <okurth@vmware.com>
Mon, 23 Oct 2017 21:21:22 +0000 (14:21 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 23 Oct 2017 21:21:22 +0000 (14:21 -0700)
open-vm-tools.

open-vm-tools/lib/include/posix.h
open-vm-tools/lib/misc/posixPwd.c
open-vm-tools/lib/misc/util_misc.c
open-vm-tools/lib/misc/vthreadBase.c
open-vm-tools/lib/panic/panic.c

index 664f858365756cfa9ba3d06fbcbc0fe02bd95a93..c5a9333648303902caf7903e1d5e5dc5d5dcc76a 100644 (file)
@@ -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);
index 483f8f0341acb879ec94109d8a10f78abe9563b1..e281ae17ad2ab82aa47d224e6e3eb5e3025f9a10 100644 (file)
@@ -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) // {
index b1d257d48921e85a104d360da79782991b1f8dfa..78667f654c96735389d22b1a14e7b20dfcb64640 100644 (file)
@@ -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)) {
index 78d65b0faee3be1c2e620aa6bea8d54d62f4d2c5..fa5169ba4e4dce6b2b85cbc8c258dcafe194f638 100644 (file)
@@ -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());
 
index b8634049105a2975caef91786ca37e26058fb928..c739842d521e8226bba5d9af5148a177295c5878 100644 (file)
@@ -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();
    }