From: Kruti Pendharkar Date: Fri, 11 Jul 2025 12:48:15 +0000 (-0700) Subject: Define Posix_Printf/Posix_Fprint for FreeBSD X-Git-Tag: stable-13.1.0~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f1325ef4e09ca5064aa03336f9729f4ee76d9bb;p=thirdparty%2Fopen-vm-tools.git Define Posix_Printf/Posix_Fprint for FreeBSD A previous change to lib/misc/posixPosix.c introduced the `Posix_Printf` and `Posix_Fprintf` implementations only for non-Solaris, non-Apple, and non-FreeBSD builds. (Note that this set of conditions is inconsistent with when `posix.h` aliases them (and various other functions) to their standard POSIX counterparts.) Moving the `Posix_Printf`/`Posix_Fprintf` implementations out of the `#if` sections so that they're always available. --- diff --git a/open-vm-tools/lib/include/posix.h b/open-vm-tools/lib/include/posix.h index c2a38673f..702f09710 100644 --- a/open-vm-tools/lib/include/posix.h +++ b/open-vm-tools/lib/include/posix.h @@ -665,7 +665,7 @@ exit: /* * ESX and Mac OS are UTF-8 environments so these functions can be * "defined away" - the POSIX wrapper call can be directly mapped to the - * POSIX function avoiding unneccesary (call and handling) overhead. + * POSIX function avoiding unnecessary (call and handling) overhead. * * NOTE: PLEASE KEEP THESE IN SORTED ORDER */ diff --git a/open-vm-tools/lib/misc/posixPosix.c b/open-vm-tools/lib/misc/posixPosix.c index 236c18dbc..e98e7b755 100644 --- a/open-vm-tools/lib/misc/posixPosix.c +++ b/open-vm-tools/lib/misc/posixPosix.c @@ -19,7 +19,7 @@ #define UNICODE_BUILDING_POSIX_WRAPPERS #if __linux__ -#define _GNU_SOURCE // Needed to get euidaccess() + #define _GNU_SOURCE // Needed to get euidaccess() #endif #include @@ -37,61 +37,62 @@ #include #if defined(__APPLE__) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if TARGET_OS_IPHONE -#include -extern char **environ; -#endif + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + + #if TARGET_OS_IPHONE + #include + extern char **environ; + #endif #elif defined(__FreeBSD__) -#include -#include + #include + #include #elif defined(sun) -#include -#include + #include + #include #else -#include -#include -#include + #include + #include + #include #endif #if (!defined(__FreeBSD__) || __FreeBSD_release >= 503001) && !defined __ANDROID__ -#define VM_SYSTEM_HAS_GETPWNAM_R 1 -#define VM_SYSTEM_HAS_GETPWUID_R 1 -#define VM_SYSTEM_HAS_GETGRNAM_R 1 + #define VM_SYSTEM_HAS_GETPWNAM_R 1 + #define VM_SYSTEM_HAS_GETPWUID_R 1 + #define VM_SYSTEM_HAS_GETGRNAM_R 1 #endif -# if defined(__FreeBSD__) -# include // PATH_MAX -# else -# include // PATH_MAX -# endif +#if defined(__FreeBSD__) + #include // PATH_MAX +#else + #include // PATH_MAX +#endif #include "vmware.h" #include "posixInt.h" #if defined(sun) -#include "hashTable.h" // For setenv emulation + #include "hashTable.h" // For setenv emulation #endif #include "vm_basic_defs.h" #if defined __ANDROID__ -/* - * Android doesn't support getmntent_r() or setmntent(). - */ -#define NO_GETMNTENT_R -#define NO_SETMNTENT + /* + * Android doesn't support getmntent_r() or setmntent(). + */ + #define NO_GETMNTENT_R + #define NO_SETMNTENT -EXTERN int truncate(const char *, off_t); + EXTERN int truncate(const char *, off_t); #endif @@ -1804,9 +1805,7 @@ Posix_Unsetenv(const char *name) // IN: } -#if !defined(sun) // { - -#if !defined(__APPLE__) && !defined(__FreeBSD__) // { +#if !defined sun && !defined __APPLE__ && !defined __FreeBSD__ // { /* *---------------------------------------------------------------------- * @@ -2132,6 +2131,9 @@ exit: } +#endif // } !defined sun && !defined __APPLE__ && !defined __FreeBSD + + /* *---------------------------------------------------------------------------- * @@ -2217,10 +2219,7 @@ Posix_Fprintf(FILE *stream, // IN: } -#endif // } !defined(__APPLE__) && !defined(__FreeBSD) - - -#else // } !defined(sun) { +#if defined sun // { /* *---------------------------------------------------------------------- * @@ -2267,7 +2266,7 @@ Posix_Getmntent(FILE *fp, // IN: return ret; } -#endif // } !defined(sun) +#endif // } defined sun /*