Fix tautologic compares. Add a few missing static specifiers for inline

functions. Don't use non-literal strings as format strings. Use z for
size_t on NetBSD. Fix inline assembler syntax of inl.
This commit is contained in:
joerg 2012-12-25 21:02:14 +00:00
parent 627b0d0bda
commit 33c1d70e11
15 changed files with 293 additions and 22 deletions

View file

@ -1,12 +1,12 @@
$NetBSD: distinfo,v 1.5 2009/09/22 07:08:05 taca Exp $
$NetBSD: distinfo,v 1.6 2012/12/25 21:02:14 joerg Exp $
SHA1 (open-vm-tools-2008.08.08-109361.tar.gz) = 1c44c3524cd9cbc5870f1c6065b03a6b31859a25
RMD160 (open-vm-tools-2008.08.08-109361.tar.gz) = 4ea0a6aa2edda2bc404c865dc5b58f3a177ae411
Size (open-vm-tools-2008.08.08-109361.tar.gz) = 2971141 bytes
SHA1 (patch-aa) = 113fdbeafe3131558167fb6c4abc9c44786d420b
SHA1 (patch-ab) = 66ab38809e1ab7b1b0dfd51b88d93a8f0faa2fad
SHA1 (patch-ac) = bb3bd4900d7fe64cb2bf79c3680a0dfac753bc95
SHA1 (patch-ad) = dbb64d3c063f9bf89483dd1d3c945d4502cefc2d
SHA1 (patch-ac) = 141db2136d1068408ca3470e11d35233f936a11c
SHA1 (patch-ad) = 4ec9292667918c23ef182ae05d5f8417d9af7673
SHA1 (patch-ae) = 785a5d5d27ce6f8281caa56a27f90a3b200ac082
SHA1 (patch-af) = 7ead621ec1b8987e64ceaa73909c74927e50330f
SHA1 (patch-ag) = 6d5d462934942ec8b7439e2e51d179e627833111
@ -16,7 +16,7 @@ SHA1 (patch-aj) = ee2e2bfc5f976d00fb4a830184e37427852a90d3
SHA1 (patch-ak) = d27cd0cbbf2db45a07a8bf4a006ad5e28feb8b3a
SHA1 (patch-al) = 0342d300f6c27a3a523f80f06d087c60c68b9a53
SHA1 (patch-am) = a4d678ad7e163de381a547cad1c24bca08c72a73
SHA1 (patch-an) = 10153f5ce56ca226fcb773f0e707fc3a1a51a902
SHA1 (patch-an) = abd94ec83c54e4ee1e64a34996db21ce86cf7ae3
SHA1 (patch-ao) = 5d6457e994f559fd826811644d2e77f46ce10d1e
SHA1 (patch-ap) = ca1a6efeaa90cf6e759e2d27ff3b2da8ffef63d0
SHA1 (patch-aq) = 18a3072f2c307ed35e5c2356e5656c0ce5f19dc0
@ -26,7 +26,7 @@ SHA1 (patch-at) = 659b97c50168fa74f3e6a8ffe2bafae0420f0d49
SHA1 (patch-au) = 31eeee4521020952ef51b29351802efd9fe4297f
SHA1 (patch-av) = b61f165fd9a6e5241795e2e69aa73caba32539a8
SHA1 (patch-aw) = 82788d7ab312ee07abf3e159028b440d41912a14
SHA1 (patch-ax) = 2649c492f501143098e41601d9ae1bc6c9ddf9cc
SHA1 (patch-ax) = 70633d0675b11aea8a8c12edbb765ad7d230276f
SHA1 (patch-ay) = c9c7a7f9871fdc3213bafce05a7433db862ac4a4
SHA1 (patch-az) = 2a8494c8cbfb0270a5fdd46e0c5ccaf19fc5f94f
SHA1 (patch-ba) = cb0433af4a7c5c9a9010edbc15998577c44c92ae
@ -50,7 +50,14 @@ SHA1 (patch-br) = 7c14091b3f7a7e75e0d7db654cff1e0476e36888
SHA1 (patch-bs) = 4b2a334ed4611c87b90f2e092cffb88aae058928
SHA1 (patch-bt) = 34c85d8d994c33fb4e18f76bb8b6baa41098f23e
SHA1 (patch-bu) = 9e2533d967cfb1cdc780516359ab8e7c373b70f5
SHA1 (patch-bv) = c15eadcf4968703c9bf4c16d368f7f7b5b39b046
SHA1 (patch-bw) = 002f3a78a5d0f52d1e1a2cd62f6ad8136f531939
SHA1 (patch-bx) = acdb1d8f25d4353e0d95ea613ea83580679b4d9f
SHA1 (patch-bv) = 180df7c4a5fb7544b6d9014f567a4f31e6c2a38d
SHA1 (patch-bw) = c242890caa3cc720d18eec612aca6e46c69c5b04
SHA1 (patch-bx) = deeea5eefae750b046d7a9c81679125e26fb82fa
SHA1 (patch-by) = c6018a330fdabefd3fc60d3e6e6c95bdf4f7f2bc
SHA1 (patch-checkvm_checkvm.c) = 142e34b40937add51db4f2255f47da23402a3720
SHA1 (patch-lib_hgfsServer_hgfsServer.c) = 68a3102d4f53626717f64284eb5e51bfb584e783
SHA1 (patch-lib_hgfsServer_hgfsServerLinux.c) = ef5a3135a8e4dc9f16d93d6eb7d88b8194aa0907
SHA1 (patch-lib_panic_panic.c) = f784479ef9000e67389c04ca80ad22da5e3a2165
SHA1 (patch-toolbox_toolboxcmd-stat.c) = 17d1188de53cea4897fc1d08a02d9db06f6bbc28
SHA1 (patch-vmware-user_copyPaste.c) = 58286d54e72d9290fc9392212d37c0c406a4e6f8
SHA1 (patch-vmware-user_dnd.c) = 9d2b242b5e5042f12440ccbf44b10367a8184b0b

View file

@ -1,6 +1,6 @@
$NetBSD: patch-ac,v 1.2 2008/08/31 06:36:47 scottr Exp $
$NetBSD: patch-ac,v 1.3 2012/12/25 21:02:15 joerg Exp $
--- guestd/foreignVMToolsDaemon.c.orig 2008-08-08 02:01:56.000000000 -0500
--- guestd/foreignVMToolsDaemon.c.orig 2008-08-08 07:01:56.000000000 +0000
+++ guestd/foreignVMToolsDaemon.c
@@ -55,7 +55,7 @@
#include <netinet/tcp.h>
@ -11,3 +11,13 @@ $NetBSD: patch-ac,v 1.2 2008/08/31 06:36:47 scottr Exp $
#include <unistd.h>
#else
#include <linux/unistd.h>
@@ -833,8 +833,7 @@ ForeignToolsSetProperties(ForeignVMTools
* Do some validation
*/
if ((NULL == asyncCommand)
- || (NULL == requestMsg)
- || (0 > requestMsg->bufferSize)) {
+ || (NULL == requestMsg)) {
err = VIX_E_INVALID_ARG;
goto abort;
}

View file

@ -1,6 +1,6 @@
$NetBSD: patch-ad,v 1.2 2008/08/31 06:36:47 scottr Exp $
$NetBSD: patch-ad,v 1.3 2012/12/25 21:02:15 joerg Exp $
--- guestd/foreignVMToolsDaemon.h.orig 2008-08-08 02:01:56.000000000 -0500
--- guestd/foreignVMToolsDaemon.h.orig 2008-08-08 07:01:56.000000000 +0000
+++ guestd/foreignVMToolsDaemon.h
@@ -59,7 +59,7 @@ VixError VIX_INIT_LOCK(VixLockType *lock
@ -11,3 +11,12 @@ $NetBSD: patch-ad,v 1.2 2008/08/31 06:36:47 scottr Exp $
#include <unistd.h>
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#else
@@ -72,7 +72,7 @@ VixError VIX_INIT_LOCK(VixLockType *lock
typedef pthread_mutex_t VixLockType;
static INLINE VixError VIX_INIT_LOCK(VixLockType *lockPtr);
-VixError VIX_INIT_LOCK(VixLockType *lockPtr)
+static INLINE VixError VIX_INIT_LOCK(VixLockType *lockPtr)
{
int result;
pthread_mutexattr_t attr;

View file

@ -1,6 +1,6 @@
$NetBSD: patch-an,v 1.2 2008/08/31 06:36:48 scottr Exp $
$NetBSD: patch-an,v 1.3 2012/12/25 21:02:15 joerg Exp $
--- lib/guestInfo/guestInfoPosix.c.orig 2008-08-08 02:01:52.000000000 -0500
--- lib/guestInfo/guestInfoPosix.c.orig 2008-08-08 07:01:52.000000000 +0000
+++ lib/guestInfo/guestInfoPosix.c
@@ -38,10 +38,11 @@
#endif
@ -15,6 +15,15 @@ $NetBSD: patch-an,v 1.2 2008/08/31 06:36:48 scottr Exp $
# include <sys/sysctl.h>
#endif
#ifndef NO_DNET
@@ -200,7 +201,7 @@ ReadInterfaceDetails(const struct intf_e
char ipAddress[NICINFO_MAX_IP_LEN];
Str_Sprintf(macAddress, sizeof macAddress,
- addr_ntoa(&entry->intf_link_addr));
+ "%s", addr_ntoa(&entry->intf_link_addr));
nic = GuestInfoAddNicEntry(nicInfo, macAddress);
if (nic == NULL) {
@@ -229,6 +230,7 @@ ReadInterfaceDetails(const struct intf_e
if (ip) {
GuestInfoAddSubnetMask(ip, entry->intf_addr.addr_bits);

View file

@ -1,6 +1,6 @@
$NetBSD: patch-ax,v 1.4 2008/09/14 16:15:05 bjs Exp $
$NetBSD: patch-ax,v 1.5 2012/12/25 21:02:15 joerg Exp $
--- lib/include/vm_basic_types.h.orig 2008-08-08 03:01:52.000000000 -0400
--- lib/include/vm_basic_types.h.orig 2008-08-08 07:01:52.000000000 +0000
+++ lib/include/vm_basic_types.h
@@ -41,7 +41,7 @@
#include "includeCheck.h"
@ -20,6 +20,15 @@ $NetBSD: patch-ax,v 1.4 2008/09/14 16:15:05 bjs Exp $
# ifdef KLD_MODULE
# include <sys/types.h>
# else
@@ -244,7 +244,7 @@ typedef int64 VmTimeVirtualClock; /* Vi
#define FMTSZ ""
#define FMTPD ""
#endif
- #elif defined(__linux__) \
+ #elif defined(__linux__) || defined(__NetBSD__) \
|| (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
|| (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
|| (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
@@ -267,7 +267,7 @@ typedef int64 VmTimeVirtualClock; /* Vi
#endif
#ifdef VM_X86_64

View file

@ -1,6 +1,6 @@
$NetBSD: patch-bv,v 1.1 2008/08/31 06:36:49 scottr Exp $
$NetBSD: patch-bv,v 1.2 2012/12/25 21:02:15 joerg Exp $
--- vmware-user/foreignVMToolsDaemon.c.orig 2008-08-08 02:01:56.000000000 -0500
--- vmware-user/foreignVMToolsDaemon.c.orig 2008-08-08 07:01:56.000000000 +0000
+++ vmware-user/foreignVMToolsDaemon.c
@@ -55,7 +55,7 @@
#include <netinet/tcp.h>
@ -11,3 +11,13 @@ $NetBSD: patch-bv,v 1.1 2008/08/31 06:36:49 scottr Exp $
#include <unistd.h>
#else
#include <linux/unistd.h>
@@ -833,8 +833,7 @@ ForeignToolsSetProperties(ForeignVMTools
* Do some validation
*/
if ((NULL == asyncCommand)
- || (NULL == requestMsg)
- || (0 > requestMsg->bufferSize)) {
+ || (NULL == requestMsg)) {
err = VIX_E_INVALID_ARG;
goto abort;
}

View file

@ -1,6 +1,6 @@
$NetBSD: patch-bw,v 1.1 2008/08/31 06:36:49 scottr Exp $
$NetBSD: patch-bw,v 1.2 2012/12/25 21:02:15 joerg Exp $
--- vmware-user/foreignVMToolsDaemon.h.orig 2008-08-08 02:01:56.000000000 -0500
--- vmware-user/foreignVMToolsDaemon.h.orig 2008-08-08 07:01:56.000000000 +0000
+++ vmware-user/foreignVMToolsDaemon.h
@@ -59,7 +59,7 @@ VixError VIX_INIT_LOCK(VixLockType *lock
@ -11,3 +11,12 @@ $NetBSD: patch-bw,v 1.1 2008/08/31 06:36:49 scottr Exp $
#include <unistd.h>
#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#else
@@ -72,7 +72,7 @@ VixError VIX_INIT_LOCK(VixLockType *lock
typedef pthread_mutex_t VixLockType;
static INLINE VixError VIX_INIT_LOCK(VixLockType *lockPtr);
-VixError VIX_INIT_LOCK(VixLockType *lockPtr)
+static INLINE VixError VIX_INIT_LOCK(VixLockType *lockPtr)
{
int result;
pthread_mutexattr_t attr;

View file

@ -1,7 +1,16 @@
$NetBSD: patch-bx,v 1.1 2008/09/14 16:15:05 bjs Exp $
$NetBSD: patch-bx,v 1.2 2012/12/25 21:02:15 joerg Exp $
--- xferlogs/xferlogs.c.orig 2008-08-08 03:01:57.000000000 -0400
--- xferlogs/xferlogs.c.orig 2008-08-08 07:01:57.000000000 +0000
+++ xferlogs/xferlogs.c
@@ -125,7 +125,7 @@ xmitFile(char *filename) //IN : file to
RpcVMX_Log("%s: %s: ver - %d", LOG_START_MARK, filename, LOG_VERSION);
while ((readLen = fread(buf, 1, sizeof buf, fp)) > 0 ) {
if (Base64_Encode(buf, readLen, base64Buf, sizeof base64B - 1, NULL)) {
- RpcVMX_Log(base64B);
+ RpcVMX_Log("%s", base64B);
} else {
Warning("Error in Base64_Encode\n");
goto exit;
@@ -200,8 +200,8 @@ extractFile(char *filename) //IN: vmx lo
* Ignore the filename in the log, for obvious security reasons
* and create a new filename consiting of time and enumerator.
@ -13,3 +22,12 @@ $NetBSD: patch-bx,v 1.1 2008/09/14 16:15:05 bjs Exp $
/*
* Read the version information, if they dont match just warn
@@ -261,7 +261,7 @@ main(int argc, char *argv[])
usage();
return -1;
} if (argc == 2) {
- RpcVMX_Log(argv[1]);
+ RpcVMX_Log("%s", argv[1]);
return 0;
}

View file

@ -0,0 +1,31 @@
$NetBSD: patch-checkvm_checkvm.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- checkvm/checkvm.c.orig 2012-12-25 19:48:10.000000000 +0000
+++ checkvm/checkvm.c
@@ -77,7 +77,7 @@ getVersion(uint32 *version)
{
uint32 eax, ebx, ecx, edx;
- __asm__ volatile("inl (%%dx)" :
+ __asm__ volatile("inl %%dx, %%eax" :
"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
"0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETVERSION),
"2"(BDOOR_PORT) : "memory");
@@ -94,7 +94,7 @@ getHWVersion(uint32 *hwVersion)
{
uint32 eax, ebx, ecx, edx;
- __asm__ volatile("inl (%%dx)" :
+ __asm__ volatile("inl %%dx, %%eax" :
"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
"0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETHWVERSION),
"2"(BDOOR_PORT) : "memory");
@@ -110,7 +110,7 @@ getScreenSize(uint32 *screensize)
{
uint32 eax, ebx, ecx, edx;
- __asm__ volatile("inl (%%dx)" :
+ __asm__ volatile("inl %%dx, %%eax" :
"=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
"0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETSCREENSIZE),
"2"(BDOOR_PORT) : "memory");

View file

@ -0,0 +1,24 @@
$NetBSD: patch-lib_hgfsServer_hgfsServer.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- lib/hgfsServer/hgfsServer.c.orig 2012-12-25 19:41:00.000000000 +0000
+++ lib/hgfsServer/hgfsServer.c
@@ -2441,7 +2441,7 @@ HgfsServerStatFs(const char *pathName, /
* delimiter on copy. Allow 0 length drives so that hidden feature "" can
* work.
*/
- if (pathLength < 0 || pathLength >= sizeof p.mountPoint) {
+ if (pathLength >= sizeof p.mountPoint) {
LOG(4, ("HgfsServerStatFs: could not get the volume name\n"));
return FALSE;
}
@@ -3305,10 +3305,6 @@ HgfsCreateAndCacheFileNode(HgfsFileOpenI
* for the share name, should be none.
*/
len = CPName_GetComponentGeneric(openInfo->cpName, inEnd, "", &next);
- if (len < 0) {
- LOG(4, ("HgfsServerGetAccess: get first component failed\n"));
- return FALSE;
- }
/* See if we are dealing with the base of the namespace */
if (!len) {

View file

@ -0,0 +1,13 @@
$NetBSD: patch-lib_hgfsServer_hgfsServerLinux.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- lib/hgfsServer/hgfsServerLinux.c.orig 2012-12-25 19:41:43.000000000 +0000
+++ lib/hgfsServer/hgfsServerLinux.c
@@ -544,7 +544,7 @@ HgfsServerGetOpenFlags(HgfsOpenFlags fla
arraySize = ARRAYSIZE(HgfsServerOpenFlags);
- if (flagsIn < 0 || flagsIn >= arraySize) {
+ if (flagsIn >= arraySize) {
Log("HgfsServerGetOpenFlags: Invalid HgfsOpenFlags %d\n", flagsIn);
return FALSE;
}

View file

@ -0,0 +1,22 @@
$NetBSD: patch-lib_panic_panic.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- lib/panic/panic.c.orig 2012-12-25 19:42:53.000000000 +0000
+++ lib/panic/panic.c
@@ -497,7 +497,7 @@ Panic_Panic(const char *format,
case 0:
break;
case 1:
- Log(buf);
+ Log("%s", buf);
Log("Panic loop\n");
default:
fprintf(stderr, "Panic loop\n");
@@ -510,7 +510,7 @@ Panic_Panic(const char *format,
* the log file on exit.
*/
- Log(buf);
+ Log("%s", buf);
Util_Backtrace(0);
Log_SetAlwaysKeep(TRUE);

View file

@ -0,0 +1,37 @@
$NetBSD: patch-toolbox_toolboxcmd-stat.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- toolbox/toolboxcmd-stat.c.orig 2012-12-25 19:51:17.000000000 +0000
+++ toolbox/toolboxcmd-stat.c
@@ -96,10 +96,6 @@ Stat_ProcessorSpeed(void)
bp.in.cx.halfs.low = BDOOR_CMD_GETMHZ;
Backdoor(&bp);
speed = bp.out.ax.word;
- if (speed < 0) {
- fprintf(stderr, "Unable to get processor speed\n");
- return EX_TEMPFAIL;
- }
printf("%u MHz\n", speed);
return EXIT_SUCCESS;
}
@@ -130,10 +126,6 @@ Stat_MemorySize(void)
bp.in.cx.halfs.low = BDOOR_CMD_GETMEMSIZE;
Backdoor(&bp);
memsize = bp.out.ax.word;
- if (memsize < 0) {
- fprintf(stderr, "Unable to get memory size\n");
- return EX_TEMPFAIL;
- }
printf("%u MB\n", memsize);
return EXIT_SUCCESS;
}
@@ -166,10 +158,6 @@ Stat_HostTime(void)
bp.in.cx.halfs.low = BDOOR_CMD_GETTIME;
Backdoor(&bp);
time = bp.out.ax.word;
- if (time < 0) {
- fprintf(stderr, "Unable to get host time\n");
- return EX_TEMPFAIL;
- }
sprintf(buf, "%u", time);
strptime(buf, "%s", &tm);
strftime(buf, sizeof(buf), "%d %b %Y %H:%M:%S", &tm);

View file

@ -0,0 +1,31 @@
$NetBSD: patch-vmware-user_copyPaste.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- vmware-user/copyPaste.c.orig 2012-12-25 19:45:44.000000000 +0000
+++ vmware-user/copyPaste.c
@@ -655,14 +655,6 @@ CopyPasteSelectionGetCB(GtkWidget
const size_t origTextLen = textLen;
Bool freeBegin = FALSE;
- if (len < 0) {
- Debug("CopyPasteSelectionGetCB: error getting next component\n");
- if (text) {
- free(text);
- }
- return;
- }
-
/*
* A URI list will expect the provided path to be escaped. If we cannot
* escape the path for some reason we just use the unescaped version and
@@ -1761,11 +1753,6 @@ CopyPasteRpcInGHGetNextFileCB(char const
cpNameSize = CPNameUtil_ConvertToRoot(fileName,
sizeof resultBuffer - (fileNameSize + 1),
resultBuffer + fileNameSize + 1);
- if (cpNameSize < 0) {
- Warning("CopyPasteRpcInGHGetNextFileCB: could not convert to CPName\n");
- return RpcIn_SetRetVals(result, resultLen,
- "error on CPName conversion", FALSE);
- }
/* Set manually because RpcIn_SetRetVals() assumes no NUL characters */
*result = resultBuffer;

View file

@ -0,0 +1,32 @@
$NetBSD: patch-vmware-user_dnd.c,v 1.1 2012/12/25 21:02:15 joerg Exp $
--- vmware-user/dnd.c.orig 2012-12-25 19:46:26.000000000 +0000
+++ vmware-user/dnd.c
@@ -943,12 +943,6 @@ DnDRpcInGetNextFileCB(char const **resul
cpNameSize = CPNameUtil_ConvertToRoot(fileName,
sizeof resultBuffer - (fileNameSize + 1),
resultBuffer + fileNameSize + 1);
- if (cpNameSize < 0) {
- Warning("DnDRpcInGetNextFileCB: could not convert to CPName\n");
- DnDGHCancel(mainWnd);
- return RpcIn_SetRetVals(result, resultLen,
- "error on CPName conversion", FALSE);
- }
/* Set manually because RpcIn_SetRetVals() assumes no NUL characters */
*result = resultBuffer;
@@ -1223,14 +1217,6 @@ DnDGtkDataRequestCB(GtkWidget *widget,
const size_t origTextLen = textLen;
Bool freeBegin = FALSE;
- if (len < 0) {
- Log("DnDGtkDataRequestCB: error getting next component\n");
- if (text) {
- free(text);
- }
- return;
- }
-
/*
* A URI list will expect the provided path to be escaped. If we cannot
* escape the path for some reason we just use the unescaped version and