From: Oliver Kurth Date: Fri, 23 Mar 2018 22:05:36 +0000 (-0700) Subject: Common source file changes that are not applicable to open-vm-tools. X-Git-Tag: stable-10.3.0~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=357d9139342c19a98ed12f5961f415d099df3287;p=thirdparty%2Fopen-vm-tools.git Common source file changes that are not applicable to open-vm-tools. --- diff --git a/open-vm-tools/lib/file/fileTemp.c b/open-vm-tools/lib/file/fileTemp.c index ae85dbe61..78b1f1781 100644 --- a/open-vm-tools/lib/file/fileTemp.c +++ b/open-vm-tools/lib/file/fileTemp.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2011-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2011-2018 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 @@ -186,9 +186,9 @@ FileMakeTempEx2Work(const char *dir, // IN: } if (errno != EEXIST) { - Log(LGPFX" Failed to create temporary %s \"%s\": %s.\n", + Log(LGPFX" Failed to create temporary %s \"%s\", errno: %d.\n", createTempFile ? "file" : "directory", - path, Err_Errno2String(errno)); + path, errno); goto exit; } } diff --git a/open-vm-tools/lib/include/err.h b/open-vm-tools/lib/include/err.h index 651fc7926..b692db43e 100644 --- a/open-vm-tools/lib/include/err.h +++ b/open-vm-tools/lib/include/err.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2004-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2004-2018 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 @@ -29,9 +29,7 @@ #define INCLUDE_ALLOW_VMCORE #include "includeCheck.h" -#if !defined(_WIN32) #include -#endif #include "vm_basic_defs.h" #if defined(__cplusplus) @@ -123,11 +121,21 @@ char *Err_SanitizeMessage(const char *msg); *---------------------------------------------------------------------- */ +#if defined(_WIN32) +#define WITH_ERRNO(e, body) do { \ + Err_Number e = Err_Errno(); \ + int __win__##e = errno; \ + body; \ + Err_SetErrno(e); \ + errno = __win__##e; \ + } while (0) +#else #define WITH_ERRNO(e, body) do { \ Err_Number e = Err_Errno(); \ body; \ Err_SetErrno(e); \ - } while (FALSE) + } while (0) +#endif #if defined(__cplusplus) } // extern "C" diff --git a/open-vm-tools/lib/include/unicodeBase.h b/open-vm-tools/lib/include/unicodeBase.h index 1c2b0efaa..b79c6c858 100644 --- a/open-vm-tools/lib/include/unicodeBase.h +++ b/open-vm-tools/lib/include/unicodeBase.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2007-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2007-2018 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 @@ -348,7 +348,11 @@ const char *Unicode_GetStatic(const char *asciiBytes, */ #if defined(_WIN32) #define UNICODE_GET_UTF16(s) Unicode_GetAllocUTF16(s) - #define UNICODE_RELEASE_UTF16(s) free((utf16_t *)s) + #define UNICODE_RELEASE_UTF16(s) do { \ + int err = errno; \ + free((utf16_t *)s); \ + errno = err; \ + } while (0) #endif #if defined(__cplusplus)