int offset = 0;
char escapedName[PATH_MAX + 1];
HgfsHandle rootHandle;
- HgfsFileName *fileName;
if (!HgfsClient_Open(&rootHandle)) {
return success;
}
while (TRUE) {
- fileName = HgfsClient_Read(rootHandle, offset++);
+ HgfsFileName *fileName = HgfsClient_Read(rootHandle, offset++);
+
if (fileName == NULL) {
break;
}
-
+
/* Are we done? */
if (fileName->length == 0) {
success = TRUE;
break;
}
- /*
+ /*
* Escape this filename. If we get back a negative result, it means that
* the escaped filename is too big, so skip this share.
*/
if (HgfsEscape_Do(fileName->name, fileName->length,
sizeof escapedName, escapedName) < 0) {
- continue;
- }
+ continue;
+ }
/* Skip "." and ".." which can be returned. */
if (strcmp(".", escapedName) == 0 ||
printf("%s\n", escapedName);
}
-
+
if (!HgfsClient_Close(rootHandle)) {
success = FALSE;
}
GdkPixbuf *pixbuf;
int width;
int height;
- int x;
- int y;
- int rowstride;
- guchar *pixels;
ASSERT((nitems - i) >= 2);
width = value[i];
i += 2;
pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
if (pixbuf) {
- pixels = gdk_pixbuf_get_pixels(pixbuf);
- rowstride = gdk_pixbuf_get_rowstride(pixbuf);
+ int x;
+ int y;
+ int rowstride = gdk_pixbuf_get_rowstride(pixbuf);
+ guchar *pixels = gdk_pixbuf_get_pixels(pixbuf);
for (y = 0; y < height; y++) {
for (x = 0; x < width && i < nitems; x++, i++) {
int timeoutMS, // IN
int *outIdx) // OUT
{
- int i;
int ret;
+
if (numSock > 0 && VALID(asock[0], waitForReadMultiple)) {
+ int i;
+
for (i = 0; i < numSock; i++) {
AsyncSocketLock(asock[i]);
}
{
ClientData clientData;
char *buffPtr;
- const char *truncStr = " DATA TRUNCATED!!!\n";
/* This API is for debugging only, so we use hard coded buffer size */
const int32 maxBuffSize = 10 * 1024;
ASSERT(buffPtr + maxBuffSize >= clientData.buffer);
if (clientData.result == DMERR_BUFFER_TOO_SMALL) {
+ const char truncStr[] = " DATA TRUNCATED!!!\n";
+
ASSERT(maxBuffSize > strlen(truncStr));
Str_Strcpy(buffPtr + maxBuffSize - strlen(truncStr) - 1, truncStr,
strlen(truncStr) + 1);
uint32 newAccess;
FileIOResult status;
FileIODescriptor tmpFD;
-#else
- int fd;
#endif
int savedErrno = 0;
int ret = 0;
*/
if (savedErrno == ENOSYS || savedErrno == ENOTTY) {
if (renameOnNFS) {
+ int fd;
+
/*
* NFS allows renames of locked files, even if both files
* are locked. The file lock follows the file handle, not
__FUNCTION__, newPath, currPath, errno);
savedErrno = errno;
} else {
+ int fd;
+
ret = TRUE;
fd = newFD->posix;
newFD->posix = currFD->posix;
/*********************************************************
- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2019 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
int err;
struct iovec iov;
struct msghdr msg;
- struct cmsghdr *cmsg;
uint8_t cmsgBuf[CMSG_SPACE(sizeof(int))];
iov.iov_base = recv_errno;
if (msg.msg_controllen == 0) {
*recv_fd = -1;
} else {
- cmsg = CMSG_FIRSTHDR(&msg);
+ struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
if ((cmsg->cmsg_level == SOL_SOCKET) &&
(cmsg->cmsg_type == SCM_RIGHTS)) {
/*********************************************************
- * Copyright (C) 2007-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2019 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
LockValues *ptr;
Bool myLockFile;
LockValues memberValues;
- char buffer[FILELOCK_DATA_SIZE];
if ((fileList[i] == NULL) ||
(*fileList[i] == 'E')) {
/* It's me! No need to read or validate anything. */
ptr = myValues;
} else {
+ char buffer[FILELOCK_DATA_SIZE];
+
/* It's not me! Attempt to extract the member values. */
err = FileLockMemberValues(lockDir, fileList[i], buffer,
FILELOCK_DATA_SIZE, &memberValues);
size_t oldPathLen = strlen(oldPath);
for (i = 0; i < numPrefixes; i++) {
- char *newPath;
char *oldPrefix;
char *newPrefix;
size_t oldPrefixLen;
(oldPath[oldPrefixLen] == '\0'))) {
size_t newPrefixLen = strlen(newPrefix);
size_t newPathLen = (oldPathLen - oldPrefixLen) + newPrefixLen;
+ char *newPath;
ASSERT(newPathLen > 0);
ASSERT(oldPathLen >= oldPrefixLen);
/*********************************************************
- * Copyright (C) 2004-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2004-2019 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
static char *
FileTryDir(const char *dirName) // IN: Is this a writable directory?
{
- char *edirName;
-
if (dirName != NULL) {
- edirName = Util_ExpandString(dirName);
+ char *edirName = Util_ExpandString(dirName);
if ((edirName != NULL) && FileIsWritableDir(edirName)) {
return edirName;
/*********************************************************
- * Copyright (C) 2004-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2004-2016,2019 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
* foundryMsg.c --
*
* This is a library for formatting and parsing the messages sent
- * between a foundry client and the VMX. It is a stand-alone library
- * so it can be used by the VMX tree without also linking in the
+ * between a foundry client and the VMX. It is a stand-alone library
+ * so it can be used by the VMX tree without also linking in the
* entire foundry client-side library.
*/
VixCommandRequestHeader *commandRequest = NULL;
size_t providedCredentialLength = 0;
size_t totalCredentialLength = 0;
- char *destPtr;
if ((VIX_USER_CREDENTIAL_NAME_PASSWORD == credentialType)
|| (VIX_USER_CREDENTIAL_HOST_CONFIG_SECRET == credentialType)
|| (VIX_USER_CREDENTIAL_TICKETED_SESSION == credentialType)
|| (VIX_USER_CREDENTIAL_SSPI == credentialType)
|| (VIX_USER_CREDENTIAL_SAML_BEARER_TOKEN == credentialType)) {
- destPtr = (char *) commandRequest;
+ char *destPtr = (char *) commandRequest;
+
destPtr += commandRequest->commonHeader.headerLength;
destPtr += commandRequest->commonHeader.bodyLength;
if (NULL != credential) {
* will always be index "0"). When not rotating, "maxFiles" is 1, so we
* always keep one backup.
*/
- gchar *log;
guint id;
GPtrArray *logfiles = g_ptr_array_new();
* file, which may or may not exist.
*/
for (id = 0; id < data->maxFiles; id++) {
- log = FileLoggerGetPath(data, id);
+ gchar *log = FileLoggerGetPath(data, id);
+
g_ptr_array_add(logfiles, log);
if (!g_file_test(log, G_FILE_TEST_IS_REGULAR)) {
break;
/*********************************************************
- * Copyright (C) 2008-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2019 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
uint32 *unprocessedLength) // IN: Unprocessed characters
// in the whole name
{
- size_t offset;
size_t sizeIn;
char* curOutBuffer;
char* escapePointer;
sizeIn = strlen(curOutBuffer);
escapePointer = strchr(curOutBuffer, HGFS_ESCAPE_CHAR);
while (escapePointer != NULL) {
- offset = escapePointer - bufIn;
+ size_t offset = escapePointer - bufIn;
+
if (HgfsIsEscapeSequence(bufIn, offset, sizeIn)) {
char* substitute = strchr(HGFS_SUBSTITUTE_CHARS, bufIn[offset - 1]);
if (substitute != NULL) {
if (vmx86_stats) {
VmTimeType value = 0;
- MXUserHeldStats *heldStats;
MXUserAcquireStats *acquireStats;
acquireStats = Atomic_ReadPtr(&lock->acquireStatsMem);
if (LIKELY(acquireStats != NULL)) {
MXUserHisto *histo;
+ MXUserHeldStats *heldStats;
MXUserAcquisitionSample(&acquireStats->data, TRUE,
value > acquireStats->data.contentionDurationFloor,
/*********************************************************
- * Copyright (C) 1998-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2017,2019 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
if (!cachedCodeset) {
char *gFilenameEncoding = getenv("G_FILENAME_ENCODING");
- char *p;
if (gFilenameEncoding && *gFilenameEncoding) {
+ char *p;
+
gFilenameEncoding = Util_SafeStrdup(gFilenameEncoding);
p = strchr(gFilenameEncoding, ',');
+
if (p) {
*p = '\0';
}
while (cpu <= nCpu &&
StdIO_ReadNextLine(f, &line, 0, NULL) == StdIO_Success) {
char *s;
- char *e;
if ((s = strstr(line, name)) &&
(s = strchr(s, ':'))) {
+ char *e;
+
s++;
e = s + strlen(s);
/*********************************************************
- * Copyright (C) 2007-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2017,2019 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
ObtainHardwareID(uint64 *hardwareID) // OUT:
{
uint32 i;
- struct ifaddrs *p;
struct ifaddrs *ifp;
// Attempt to get the list of networking interfaces
// search through a "reasonable" number of interfaces
for (i = 0, *hardwareID = 0; i < 8; i++) {
- p = CheckEthernet(ifp, i);
+ struct ifaddrs *p = CheckEthernet(ifp, i);
if (p != NULL) {
memcpy(hardwareID, LLADDR((struct sockaddr_dl *)p->ifa_addr), ETHER_ADDR_LEN);
/*********************************************************
- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2019 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
char *tmp;
size_t lenWhat;
size_t lenWith;
- size_t lenBefore;
size_t occurrences = 0;
size_t lenNew;
result = tmp;
while (occurrences--) {
+ size_t lenBefore;
+
current = strstr(orig, what);
lenBefore = current - orig;
tmp = memcpy(tmp, orig, lenBefore);
if (cpath != NULL) {
char *apath = NULL;
- int retlen;
WCHAR *wcpath = Unicode_GetAllocUTF16(cpath);
/* First get the length of multibyte string */
int alen = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, wcpath, -1,
NULL, 0, NULL, NULL);
if (alen > 0) {
+ int retlen;
+
/* Now get the converted string */
ret = Util_SafeMalloc(alen);
retlen = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, wcpath, -1,
* records are intermingled with AF_INET and AF_INET6 records.
*/
for (pkt = ifaddrs; pkt != NULL; pkt = pkt->ifa_next) {
- GuestNicV3 *nic;
- struct ifaddrs *ip;
struct sockaddr_ll *sll = (struct sockaddr_ll *)pkt->ifa_addr;
if (GuestInfo_IfaceGetPriority(pkt->ifa_name) != priority ||
if (sll != NULL && sll->sll_family == AF_PACKET) {
char macAddress[NICINFO_MAC_LEN];
+ GuestNicV3 *nic;
+ struct ifaddrs *ip;
/*
* PR 2193804:
if (entry->intf_type == INTF_TYPE_ETH &&
entry->intf_link_addr.addr_type == ADDR_TYPE_ETH) {
- GuestNicV3 *nic = NULL;
- char macAddress[NICINFO_MAC_LEN];
/*
* There is a race where the guest info plugin might be iterating over the
* pick up any changes.
*/
if (entry->intf_link_addr.addr_type == ADDR_TYPE_ETH) {
+ char macAddress[NICINFO_MAC_LEN];
+ GuestNicV3 *nic = NULL;
+
Str_Sprintf(macAddress, sizeof macAddress, "%s",
addr_ntoa(&entry->intf_link_addr));
/*********************************************************
- * Copyright (C) 2013-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2013-2017,2019 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
int len) // IN
{
int remaining = len;
- int rv;
int sysErr;
while (remaining > 0) {
- rv = recv(fd, buf , remaining, 0);
+ int rv = recv(fd, buf , remaining, 0);
if (rv == 0) {
Debug(LGPFX "Socket %d closed by peer.", fd);
return FALSE;
void *clientData) // IN
{
ConnInfo *conn = (ConnInfo *)clientData;
- char const *errmsg ="RpcIn: vsocket connection error";
RpcIn *in = conn->in;
Debug("RpcIn: Error in socket %d, closing connection: %s.\n",
in->errStatus = TRUE;
if (conn->connected) {
- RpcInCloseChannel(conn->in, errmsg);
+ RpcInCloseChannel(conn->in, "RpcIn: vsocket connection error");
} else { /* the connection never gets connected */
RpcInCloseConn(conn);
Debug("RpcIn: falling back to use backdoor ...\n");
UnicodeICUTest(void)
{
StringEncoding enc, enc2;
- const char *name;
Bool supported;
Bool redirected;
Bool canGetBytes;
for (enc = STRING_ENCODING_FIRST; enc < STRING_ENCODING_MAX_SPECIFIED;
enc++ ) {
- name = Unicode_EncodingEnumToName(enc);
+ const char *name = Unicode_EncodingEnumToName(enc);
+
enc2 = Unicode_EncodingNameToEnum(name);
redirected = FALSE;
if (enc2 == STRING_ENCODING_UNKNOWN) {
{
uint32 checksum = 0;
struct UtilVector *vector = (struct UtilVector *) iov;
- uint32 partialChecksum;
int bytesSoFar = 0;
- int rotate;
while (numEntries-- > 0) {
- partialChecksum = Util_Checksum(vector->base, vector->len);
- rotate = (bytesSoFar & 3) * 8;
+ uint32 partialChecksum = Util_Checksum(vector->base, vector->len);
+ int rotate = (bytesSoFar & 3) * 8;
+
checksum ^= ((partialChecksum << rotate) |
(partialChecksum >> (32 - rotate)));
bytesSoFar += vector->len;
char* pkgCommand = NULL;
char* command = NULL;
int deploymentResult = 0;
- char *nics;
char* cleanupCommand;
uint8 archiveType;
uint8 flags;
sLog(log_error, "Deployment failed."
"The forked off process returned error code.\n");
} else {
- nics = GetNicsToEnable(imcDirPath);
+ char *nics = GetNicsToEnable(imcDirPath);
+
if (nics) {
// XXX: Sleep before the last SetCustomizationStatusInVmx
// This is a temporary-hack for PR 422790
/*********************************************************
- * Copyright (C) 2007-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2016,2019 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
{
char buf[1024];
size_t currSize, newSize;
- ssize_t count;
char** saveTo;
int fd;
char* stdstr = stdout ? "stdout" : "stderr";
// if there's output waiting, read it out. FDs should already be non-blocking
do {
- count = read(fd, buf, sizeof buf);
+ ssize_t count = read(fd, buf, sizeof buf);
+
if (count > 0) {
// save output
currSize = strlen(*saveTo);
/*********************************************************
- * Copyright (C) 2004 VMware, Inc. All rights reserved.
+ * Copyright (C) 2004,2019 VMware, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common
* Development and Distribution License (the "License") version 1.0
static void
Vxn_ApplyAddressFilter(vxn_softc_t *dp)
{
- uint8_t *ep;
int i, j, bit, byte;
- uint32_t crc, poly = CRC_POLYNOMIAL_LE;
Vmxnet2_DriverData *dd = dp->driverData;
volatile uint16_t *mcastTable = (uint16_t *)dd->LADRF;
dd->LADRF[1] = 0;
for (i = 0; i < dp->multiCount; i++) {
- crc = 0xffffffff;
- ep = (uint8_t *)&dp->multicastList[i].ether_addr_octet;
+ uint32_t crc = 0xffffffff;
+ uint32_t poly = CRC_POLYNOMIAL_LE;
+ uint8_t *ep = (uint8_t *)&dp->multicastList[i].ether_addr_octet;
for (byte = 0; byte < 6; byte++) {
for (bit = *ep++, j = 0; j < 8; j++, bit >>= 1) {
static boolean_t
Vxn_Receive(vxn_softc_t *dp)
{
- int ringnext;
- short pktlen;
- Vmxnet2_DriverData *dd = dp->driverData;
+ Vmxnet2_DriverData *dd = dp->driverData;
rx_dma_buf_t *rxDesc;
rx_dma_buf_t *newRxDesc;
mblk_t *mblk;
ASSERT(MUTEX_HELD(&dp->intrlock));
/*
- * Walk receive ring looking for entries with ownership
+ * Walk receive ring looking for entries with ownership
* reverted back to driver
*/
while (1) {
Vmxnet2_RxRingEntry *rre;
rx_dma_buf_t **rbuf;
+ short pktlen;
+ int ringnext = dd->rxDriverNext;
- ringnext = dd->rxDriverNext;
rre = &dp->rxRing[ringnext];
rbuf = &dp->rxRingBuffPtr[ringnext];
-
+
if (rre->ownership != VMXNET2_OWNERSHIP_DRIVER) {
break;
}
void *prop_val)
{
vmxnet3_softc_t *dp = data;
- int ret = 0;
switch (prop_id) {
case MAC_PROP_MTU: {
}
default: {
VMXNET3_WARN(dp, "vmxnet3_get_prop property %d not supported", prop_id);
- ret = ENOTSUP;
}
}
return (0);
/*********************************************************
- * Copyright (C) 2007 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007,2019 VMware, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of the Common
* Development and Distribution License (the "License") version 1.0
vmxnet3_rx_hwcksum(vmxnet3_softc_t *dp, mblk_t *mp,
Vmxnet3_GenericDesc *compDesc)
{
- uint32_t flags = 0;
-
if (!compDesc->rcd.cnc) {
+ uint32_t flags = 0;
+
if (compDesc->rcd.v4 && compDesc->rcd.ipc) {
flags |= HCK_IPV4_HDRCKSUM;
if ((compDesc->rcd.tcp || compDesc->rcd.udp) &&
static void
PrintInternalCommand(const char *data, size_t dataSize)
{
- int readCounter = 0;
char *tmp = NULL;
char *printBuf = NULL;
if (dataSize > 0) {
+ int readCounter = 0;
+
printBuf = (char *) calloc((int)dataSize, sizeof(char));
if (printBuf == NULL) {
fprintf(stderr, "Out of memory error");
PostVerifySetKeyOptions(GOptionContext *context, GOptionGroup *group,
gpointer data, GError **error)
{
- int usedOptions = 0;
NamespaceOptionsState *nsOptions;
+
ASSERT(data);
nsOptions = (NamespaceOptionsState *) data;
return FALSE;
}
if (g_strcmp0(nsOptions->cmdName, NSDB_SET_KEY_USER_CMD) == 0) {
+ int usedOptions = 0;
+
if (nsOptions->keyName == NULL) {
g_set_error(error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
"Key name must be specified");
gboolean
DeployPkg_TcloBegin(RpcInData *data) // IN
{
- static char resultBuffer[FILE_MAXPATH];
char *tempDir = DeployPkgGetTempDir();
g_debug("DeployPkgTcloBegin got call\n");
if (tempDir) {
+ static char resultBuffer[FILE_MAXPATH];
+
Str_Strcpy(resultBuffer, tempDir, sizeof resultBuffer);
free(tempDir);
return RPCIN_SETRETVALS(data, resultBuffer, TRUE);
{
char errMsg[2048];
ToolsDeployPkgError ret;
- gchar *msg;
char *pkgNameStr = (char *) pkgName;
g_debug("%s: Deploypkg deploy task started.\n", __FUNCTION__);
/* Unpack the package and run the command. */
ret = DeployPkgDeployPkgInGuest(ctx, pkgNameStr, errMsg, sizeof errMsg);
if (ret != TOOLSDEPLOYPKG_ERROR_SUCCESS) {
- msg = g_strdup_printf("deployPkg.update.state %d %d %s",
- TOOLSDEPLOYPKG_DEPLOYING,
- TOOLSDEPLOYPKG_ERROR_DEPLOY_FAILED,
- errMsg);
+ gchar *msg = g_strdup_printf("deployPkg.update.state %d %d %s",
+ TOOLSDEPLOYPKG_DEPLOYING,
+ TOOLSDEPLOYPKG_ERROR_DEPLOY_FAILED,
+ errMsg);
+
if (!RpcChannel_Send(ctx->rpc, msg, strlen(msg), NULL, NULL)) {
g_warning("%s: failed to send error code %d for state TOOLSDEPLOYPKG_DEPLOYING\n",
__FUNCTION__,
GdkAtom target)
{
const char *selection_handler_key = "gtk-selection-handlers";
- struct SelectionTargetList *targetList;
GList *tempList;
GList *selectionLists;
tempList = selectionLists;
while (tempList) {
/* Enumerate the list to find the selection. */
- targetList = tempList->data;
+ struct SelectionTargetList *targetList = tempList->data;
if (targetList->selection == selection) {
/* Remove target. */
gtk_target_list_remove(targetList->list, target);
CopyPasteSetBackdoorSelections(void)
{
uint32 const *p;
- size_t len;
- size_t aligned_len;
size_t primaryLen;
size_t clipboardLen;
- unsigned int i;
primaryLen = strlen(gGuestSelPrimaryBuf);
clipboardLen = strlen(gGuestSelClipboardBuf);
CopyPaste_SetSelLength(0);
g_debug("CopyPasteSetBackdoorSelections Set empty text.\n");
} else {
- len = strlen((char *)p);
+ size_t len = strlen((char *)p);
+ size_t aligned_len;
+ unsigned int i;
+
g_debug("CopyPasteSetBackdoorSelections Set text [%s].\n", (char *)p);
aligned_len = (len + 4) & ~3;
{
utf::string source;
char *newPath;
- char *newRelPath;
size_t newPathLen;
size_t index = 0;
DnDFileList fileList;
while ((newPath = DnD_UriListGetNextFile(source.c_str(),
&index,
&newPathLen)) != NULL) {
+ char *newRelPath;
+
#if defined(__linux__)
if (DnD_UriIsNonFileSchemes(newPath)) {
/* Try to get local file path for non file uri. */
/*********************************************************
- * Copyright (C) 2007-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2007-2016,2019 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
DnDMsg_Serialize(DnDMsg *msg, // IN/OUT: the message
DynBuf* buf) // OUT: the output buffer
{
- DynBuf *curArg;
uint32 nargs;
uint32 i;
uint32 serializeArgsSz = 0;
uint32 curArgsSz;
for (i = 0; i < nargs; i++) {
- curArg = DynBufArray_AddressOf(&msg->args, i);
+ DynBuf *curArg = DynBufArray_AddressOf(&msg->args, i);
+
curArgsSz = DynBuf_GetSize(curArg);
if (!DynBuf_Append(buf, &curArgsSz, sizeof curArgsSz) ||
Xdg_GetCacheHome(void)
{
static char *result = NULL;
- struct passwd *pw;
if (result == NULL) {
do {
+ struct passwd *pw;
+
if (!Id_IsSetUGid()) {
const char *base = NULL;
guint info, // UNUSED
guint time) // IN: event timestamp
{
- size_t index = 0;
std::string str;
std::string uriList;
std::string stagingDirName;
if ( target == DRAG_TARGET_NAME_URI_LIST
&& CPClipboard_GetItem(&mClipboard, CPFORMAT_FILELIST, &buf, &sz)) {
+ size_t index = 0;
/* Provide path within vmblock file system instead of actual path. */
stagingDirName = GetLastDirName(mHGStagingDir);
bool
DnDUIX11::SetCPClipboardFromGtk(const Gtk::SelectionData& sd) // IN
{
- char *newPath;
- char *newRelPath;
- size_t newPathLen;
- size_t index = 0;
DnDFileList fileList;
DynBuf buf;
uint64 totalSize = 0;
* one for just the last path component.
*/
utf::string source = sd.get_data_as_string().c_str();
+ size_t index = 0;
+ char *newPath;
+ size_t newPathLen;
+
g_debug("%s: Got file list: [%s]\n", __FUNCTION__, source.c_str());
if (sd.get_data_as_string().length() == 0) {
while ((newPath = DnD_UriListGetNextFile(source.c_str(),
&index,
&newPathLen)) != NULL) {
+ char *newRelPath;
+
#if defined(__linux__)
if (DnD_UriIsNonFileSchemes(newPath)) {
/* Try to get local file path for non file uri. */
if (!CopyPaste_IsRpcCPSupported() ||
(absoluteMouseState == ABSMOUSE_UNAVAILABLE)) {
-
- GSource *src;
-
CopyPasteDnDWrapper *wrapper = CopyPasteDnDWrapper::GetInstance();
ToolsAppCtx *ctx = wrapper->GetToolsAppCtx();
+
if (ctx) {
- src = VMTools_CreateTimer(POINTER_UPDATE_TIMEOUT);
+ GSource *src = VMTools_CreateTimer(POINTER_UPDATE_TIMEOUT);
+
VMTOOLSAPP_ATTACH_SOURCE(ctx, src, PointerUpdatePointerLoop, NULL, NULL);
g_source_unref(src);
}
/*********************************************************
- * Copyright (C) 2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2018-2019 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
void
VMCopyPasteDnDWrapper::OnCapReg(gboolean set)
{
+ ToolsAppCtx *ctx;
+
g_debug("%s: enter\n", __FUNCTION__);
- char *reply = NULL;
- size_t replyLen;
- const char *toolsDnDVersion = TOOLS_DND_VERSION_4;
- char *toolsCopyPasteVersion = NULL;
- int version;
- ToolsAppCtx *ctx = GetToolsAppCtx();
+ ctx = GetToolsAppCtx();
if (ctx) {
+ char *reply = NULL;
+ size_t replyLen;
+ const char *toolsDnDVersion = TOOLS_DND_VERSION_4;
+ char *toolsCopyPasteVersion = NULL;
+ int version;
+
/*
* First DnD.
*/
DiskInfoChanged(const GuestDiskInfoInt *diskInfo)
{
int index;
- char *name;
int i;
- int matchedPartition;
GuestDiskInfoInt *cachedDiskInfo;
cachedDiskInfo = gInfoCache.diskInfo;
/* Have any disks been modified? */
for (index = 0; index < cachedDiskInfo->numEntries; index++) {
- name = cachedDiskInfo->partitionList[index].name;
+ int matchedPartition;
+ char *name = cachedDiskInfo->partitionList[index].name;
/* Find the corresponding partition in the new partition info. */
for (i = 0; i < diskInfo->numEntries; i++) {
/*********************************************************
- * Copyright (C) 2010-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2010-2017,2019 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
RandR12Info *info) // IN: RandR12Info context
{
XRRScreenResources *xrrRes = info->xrrRes;
- XRRModeInfo *modeInfo;
- RandR12Output *rrOutput;
unsigned int i, j;
unsigned int w, h;
Bool used;
*/
for (i = 0; i < xrrRes->nmode; ++i) {
- modeInfo = &xrrRes->modes[i];
+ XRRModeInfo *modeInfo = &xrrRes->modes[i];
+
if (sscanf(modeInfo->name, RR12_MODE_FORMAT, &w, &h) != 2) {
continue;
}
*/
for (j = 0; j < info->nOutput; ++j) {
- rrOutput = &info->outputs[j];
+ RandR12Output *rrOutput = &info->outputs[j];
if (rrOutput->mode != modeInfo->id) {
if (RandR12OutputHasMode(rrOutput->output, modeInfo)) {
/*********************************************************
- * Copyright (C) 2008-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2017,2019 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
*********************************************************/
/*
- * @file resolutionX11.c
+ * @file resolutionX11.c
*
* X11 backend for resolutionSet plugin.
*/
*/
if (major > 1 || (major == 1 && minor >= 2)) {
XRRScreenResources* xrrRes;
- XRROutputInfo* xrrOutput;
unsigned int num;
- int i;
xrrRes = XRRGetScreenResources(resInfoX->display, resInfoX->rootWindow);
if (xrrRes) {
+ int i;
+
for (i = 0; i < xrrRes->noutput; i++) {
- xrrOutput = XRRGetOutputInfo(resInfoX->display, xrrRes,
- xrrRes->outputs[i]);
+ XRROutputInfo* xrrOutput =
+ XRRGetOutputInfo(resInfoX->display, xrrRes,
+ xrrRes->outputs[i]);
+
if (!xrrOutput) {
break;
}
}
while (index >= 0 && scripts[index].path != NULL) {
- char *cmd;
-
if (File_IsFile(scripts[index].path)) {
+ char *cmd;
+
if (op->state->scriptArg != NULL) {
cmd = Str_Asprintf(NULL, "\"%s\" %s \"%s\"", scripts[index].path,
scriptOp, op->state->scriptArg);
static void
VmBackupScriptOpRelease(VmBackupOp *_op) // IN
{
- size_t i;
VmBackupScriptOp *op = (VmBackupScriptOp *) _op;
if (op->type != VMBACKUP_SCRIPT_FREEZE && op->state->scripts != NULL) {
+ size_t i;
VmBackupScript *scripts = op->state->scripts;
+
for (i = 0; scripts[i].path != NULL; i++) {
free(scripts[i].path);
if (scripts[i].proc != NULL) {
{ "Set_Option", ToolsCoreRpcSetOption, NULL, NULL, NULL, 0 },
};
- size_t i;
const gchar *app;
GMainContext *mainCtx = g_main_loop_get_context(state->ctx.mainLoop);
*/
RpcChannelFailureCb failureCb = NULL;
guint errorLimit = 0;
+ size_t i;
#if !defined(_WIN32)
/*********************************************************
- * Copyright (C) 2008-2016 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2016,2019 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
char *argv[])
{
int status;
- char op;
if (argc < 2 ||
strcmp(argv[1], "-h") == 0 ||
printf("Opened " VMBLOCK_DEVICE " as fd %d.\n", fd);
while (1) {
- op = getchar();
+ char op = getchar();
+
if (op == 'a') {
status = VMBLOCK_CONTROL(fd, VMBLOCK_ADD_FILEBLOCK, argv[1]);
if (status != 0) {
* will always be index "0"). When not rotating, "maxFiles" is 1, so we
* always keep one backup.
*/
- gchar *fname;
guint id;
GPtrArray *logfiles = g_ptr_array_new();
* file, which may or may not exist.
*/
for (id = 0; id < data->maxFiles; id++) {
- fname = g_strdup_printf("%s.%d", data->path, id);
+ gchar *fname = g_strdup_printf("%s.%d", data->path, id);
+
g_ptr_array_add(logfiles, fname);
if (!g_file_test(fname, G_FILE_TEST_IS_REGULAR)) {
break;
{
ServiceConnection *newConn = NULL;
ServiceConnection *lConn = (ServiceConnection *) userData;
- VGAuthError err = VGAUTH_E_OK;
-#ifdef _WIN32
- GSource *gSourceData;
-#else
- GIOChannel *echan;
-#endif
+ VGAuthError err;
err = ServiceConnectionClone(lConn, &newConn);
if (VGAUTH_E_OK != err) {
err = ServiceAcceptConnection(lConn, newConn);
if (VGAUTH_E_OK == err) {
+#ifdef _WIN32
+ GSource *gSourceData;
+#else
+ GIOChannel *echan;
+#endif
+
VGAUTH_LOG_DEBUG("Established a new pipe connection %d on %s", newConn->connId,
newConn->pipeName);
#ifdef _WIN32
{
AliasParseList *list = (AliasParseList *) userData;
ServiceAliasInfo *infos;
- int n;
ASSERT(list);
break;
case ALIAS_PARSE_STATE_ALIASINFOS:
if (g_strcmp0(elementName, ALIASINFO_ALIASINFO_ELEMENT_NAME) == 0) {
+ int n;
+
list->state = ALIAS_PARSE_STATE_ALIASINFO;
// grow
{
VGAuthError err;
gchar *packet;
- gchar *endPacket;
int num;
- int i;
- int j;
ServiceMappedAlias *maList;
/*
if (err != VGAUTH_E_OK) {
packet = Proto_MakeErrorReply(conn, req, err, "queryMappedIds failed");
} else {
+ int i;
+ gchar *endPacket;
+
packet = g_markup_printf_escaped(VGAUTH_QUERYMAPPEDALIASES_REPLY_FORMAT_START,
req->sequenceNumber);
for (i = 0; i < num; i++) {
gchar *tPacket;
+ int j;
tPacket = g_markup_printf_escaped(VGAUTH_MAPPEDALIASES_FORMAT_START,
maList[i].userName,
* Dump the token cert chain for debugging purposes.
*/
if (gVerboseLogging) {
- gchar *chainx509;
-
for (i = 0; i < numCerts; i++) {
- chainx509 = CertVerify_CertToX509String(pemCertChain[i]);
+ gchar *chainx509 = CertVerify_CertToX509String(pemCertChain[i]);
Debug("%s: Token chain cert #%d:\n%s", __FUNCTION__, i, chainx509);
g_free(chainx509);
}
* Dump the store cert chain for debugging purposes.
*/
if (gVerboseLogging) {
- gchar *storex509;
-
Debug("%s: %d certs in store for user %s\n", __FUNCTION__,
numStoreCerts, queryUserName);
for (i = 0; i < numStoreCerts; i++) {
- storex509 = CertVerify_CertToX509String(aList[i].pemCert);
+ gchar *storex509 = CertVerify_CertToX509String(aList[i].pemCert);
+
Debug("%s: Store chain cert #%d:\n%s", __FUNCTION__, i, storex509);
g_free(storex509);
}
/*********************************************************
- * Copyright (C) 2008-2018 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2019 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
VMBlockGetAttr(const char *path, // IN: File to get attributes of.
struct stat *statBuf) // OUT: Where to put the attributes.
{
- int status;
char target[PATH_MAX + 1];
vmblockSpecialDirEntry *dirEntry;
ASSERT(path != NULL);
}
}
if (strncmp(path, REDIRECT_DIR, strlen(REDIRECT_DIR)) == 0) {
- status = RealReadLink(path, target, sizeof target);
+ int status = RealReadLink(path, target, sizeof target);
+
LOG(4, "%s: Called RealReadLink which returned: %d\n", __func__, status);
if (status != 0) {
return status;
off_t offset, // IN: Ignored.
struct fuse_file_info *fileInfo) // IN: Ignored.
{
- char target[PATH_MAX+1];
- char targetLink[PATH_MAX+1];
const char redirectPrefix[] = REDIRECT_DIR "/";
const char redirectPrefixLength = sizeof redirectPrefix - 1;
const char notifyPrefix[] = NOTIFY_DIR "/";
}
if (strncmp(path, NOTIFY_DIR, strlen(NOTIFY_DIR)) == 0) {
+ char target[PATH_MAX+1];
+ char targetLink[PATH_MAX+1];
+
strlcpy(target, redirectPrefix, sizeof target);
strlcpy(target + redirectPrefixLength,
relativePath,
{
HgfsAttrCache *tmp;
int res = -1;
- int diff;
pthread_mutex_lock(&HgfsAttrCacheLock);
tmp = (HgfsAttrCache *)g_hash_table_lookup(g_hash_table, path);
if (tmp != NULL) {
+ int diff;
+
LOG(4, ("cache hit. path = %s\n", tmp->path));
diff = (HGFS_GET_TIME(time(NULL)) - tmp->changeTime) / 10000000;
HgfsReq *req) // IN/OUT: req packet
{
HgfsAttrV2 *attrV2;
- HgfsAttr *attrV1;
- HgfsAttrChanges *update;
size_t reqBufferSize;
size_t reqSize;
ASSERT(req);
}
case HGFS_OP_SETATTR: {
int result;
+ HgfsAttr *attrV1;
HgfsRequestSetattr *request;
+ HgfsAttrChanges *update;
request = (HgfsRequestSetattr *)(HGFS_REQ_PAYLOAD(req));
-
attrV1 = &request->attr;
update = &request->update;