unsigned int privflags G_GNUC_UNUSED)
{
size_t i;
- struct _virDomainInterfaceStats tmp;
if (!virDomainObjIsActive(dom))
return 0;
for (i = 0; i < dom->def->nnets; i++) {
virDomainNetDef *net = dom->def->nets[i];
virDomainNetType actualType;
+ struct _virDomainInterfaceStats tmp = { 0 };
if (!net->ifname)
continue;
- memset(&tmp, 0, sizeof(tmp));
-
actualType = virDomainNetGetActualType(net);
virTypedParamListAddString(params, net->ifname, "net.%zu.name", i);
remote_auth_sasl_init_ret iret;
remote_auth_sasl_start_args sargs = {0};
remote_auth_sasl_start_ret sret;
- remote_auth_sasl_step_args pargs = {0};
- remote_auth_sasl_step_ret pret;
const char *clientout;
char *serverin = NULL;
size_t clientoutlen, serverinlen;
* Even if the server has completed, the client must *always* do at least one step
* in this loop to verify the server isn't lying about something. Mutual auth */
for (;;) {
+ remote_auth_sasl_step_args pargs = { 0 };
+ remote_auth_sasl_step_ret pret = { 0 };
+
if ((err = virNetSASLSessionClientStep(sasl,
serverin,
serverinlen,
/* Not done, prepare to talk with the server for another iteration */
/* NB, distinction of NULL vs "" is *critical* in SASL */
- memset(&pargs, 0, sizeof(pargs));
pargs.nil = clientout ? 0 : 1;
pargs.data.data_val = (char*)clientout;
pargs.data.data_len = clientoutlen;
VIR_DEBUG("Server step with %zu bytes %p",
clientoutlen, clientout);
- memset(&pret, 0, sizeof(pret));
if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP,
(xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs,
(xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0)
size_t keyLength;
char *errmsg;
g_auto(virBuffer) buff = VIR_BUFFER_INITIALIZER;
- virConnectCredential askKey;
struct libssh2_knownhost *knownHostEntry = NULL;
size_t i;
char *hostnameStr = NULL;
case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND:
/* key was not found, query to add it to database */
if (sess->hostKeyVerify == VIR_NET_SSH_HOSTKEY_VERIFY_NORMAL) {
+ virConnectCredential askKey = { 0 };
+
/* ask to add the key */
if (!sess->cred || !sess->cred->cb) {
virReportError(VIR_ERR_SSH, "%s",
}
/* prepare data for the callback */
- memset(&askKey, 0, sizeof(virConnectCredential));
-
for (i = 0; i < sess->cred->ncredtype; i++) {
if (sess->cred->credtype[i] == VIR_CRED_ECHOPROMPT)
break;
virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr)
{
unsigned int features;
- struct ifreq ifreq;
short new_flags = 0;
size_t i;
for (i = 0; i < tapfdSize; i++) {
- memset(&ifreq, 0, sizeof(ifreq));
+ struct ifreq ifreq = { 0 };
if (ioctl(tapfd[i], TUNGETIFF, &ifreq) < 0) {
virReportSystemError(errno, "%s",
unsigned int flags)
{
size_t i = 0;
- struct ifreq ifr;
int rc;
int ret = -1;
int fd = -1;
if (!tunpath)
tunpath = "/dev/net/tun";
- memset(&ifr, 0, sizeof(ifr));
for (i = 0; i < tapfdSize; i++) {
+ struct ifreq ifr = { 0 };
+
if ((fd = open(tunpath, O_RDWR)) < 0) {
virReportSystemError(errno,
_("Unable to open %1$s, is tun module loaded?"),
goto cleanup;
}
- memset(&ifr, 0, sizeof(ifr));
-
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
/* If tapfdSize is greater than one, request multiqueue */
if (tapfdSize > 1)
virSetHostUUIDStr(const char *uuid)
{
int rc;
- char dmiuuid[VIR_UUID_STRING_BUFLEN];
if (virUUIDIsValid(host_uuid))
return EEXIST;
if (!uuid) {
- memset(dmiuuid, 0, sizeof(dmiuuid));
+ char dmiuuid[VIR_UUID_STRING_BUFLEN] = { 0 };
+
if (!getDMISystemUUID(dmiuuid, sizeof(dmiuuid))) {
if (!virUUIDParse(dmiuuid, host_uuid))
return 0;
checkProtocols(bool *hasIPv4, bool *hasIPv6,
int *freePort)
{
- struct sockaddr_in in4;
- struct sockaddr_in6 in6;
size_t i;
*freePort = 0;
return -1;
for (i = 0; i < 50; i++) {
+ struct sockaddr_in in4 = { 0 };
+ struct sockaddr_in6 in6 = { 0 };
VIR_AUTOCLOSE s4 = -1;
VIR_AUTOCLOSE s6 = -1;
return -1;
}
- memset(&in4, 0, sizeof(in4));
- memset(&in6, 0, sizeof(in6));
-
in4.sin_family = AF_INET;
in4.sin_port = htons(BASE_PORT + i);
in4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
static bool
cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
{
- virDomainBlockInfo info;
g_autoptr(virshDomain) dom = NULL;
bool human = false;
bool all = false;
g_autofree char *cap = NULL;
g_autofree char *alloc = NULL;
g_autofree char *phy = NULL;
+ virDomainBlockInfo info = { 0 };
ctxt->node = disks[i];
protocol = virXPathString("string(./source/@protocol)", ctxt);
return false;
}
}
- } else {
- /* if we don't call virDomainGetBlockInfo() who clears 'info'
- * we have to do it manually */
- memset(&info, 0, sizeof(info));
}
if (!cmdDomblkinfoGet(&info, &cap, &alloc, &phy, human))
g_autofree char *cap = NULL;
g_autofree char *alloc = NULL;
g_autofree char *phy = NULL;
+ virDomainBlockInfo info = { 0 };
if (virDomainGetBlockInfo(dom, device, &info, 0) < 0)
return false;