Various fixes following a code review part 2

* daemon/libvirtd.c tools/virsh.c: Steve Grubb <sgrubb@redhat.com> found
  a few more issues
This commit is contained in:
Daniel Veillard
2009-11-10 14:40:22 +01:00
parent 52147a0452
commit 117aa0d874
2 changed files with 6 additions and 12 deletions

View File

@@ -359,7 +359,6 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED,
void *opaque) { void *opaque) {
struct qemud_server *server = (struct qemud_server *)opaque; struct qemud_server *server = (struct qemud_server *)opaque;
siginfo_t siginfo; siginfo_t siginfo;
int ret;
virMutexLock(&server->lock); virMutexLock(&server->lock);
@@ -371,8 +370,6 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED,
return; return;
} }
ret = 0;
switch (siginfo.si_signo) { switch (siginfo.si_signo) {
case SIGHUP: case SIGHUP:
VIR_INFO0(_("Reloading configuration on SIGHUP")); VIR_INFO0(_("Reloading configuration on SIGHUP"));
@@ -392,9 +389,6 @@ qemudDispatchSignalEvent(int watch ATTRIBUTE_UNUSED,
break; break;
} }
if (ret != 0)
server->quitEventThread = 1;
virMutexUnlock(&server->lock); virMutexUnlock(&server->lock);
} }

View File

@@ -4627,8 +4627,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
if (format) { if (format) {
virBufferAddLit(&buf, " <target>\n"); virBufferAddLit(&buf, " <target>\n");
if (format) virBufferVSprintf(&buf, " <format type='%s'/>\n",format);
virBufferVSprintf(&buf, " <format type='%s'/>\n",format);
virBufferAddLit(&buf, " </target>\n"); virBufferAddLit(&buf, " </target>\n");
} }
virBufferAddLit(&buf, "</volume>\n"); virBufferAddLit(&buf, "</volume>\n");
@@ -6835,6 +6834,7 @@ editWriteToTempFile (vshControl *ctl, const char *doc)
if (fd == -1) { if (fd == -1) {
vshError(ctl, _("mkstemp: failed to create temporary file: %s"), vshError(ctl, _("mkstemp: failed to create temporary file: %s"),
strerror(errno)); strerror(errno));
free (ret);
return NULL; return NULL;
} }
@@ -7675,7 +7675,7 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
*name = n; *name = n;
/* try it by UUID */ /* try it by UUID */
if (network==NULL && (flag & VSH_BYUUID) && strlen(n)==VIR_UUID_STRING_BUFLEN-1) { if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
vshDebug(ctl, 5, "%s: <%s> trying as network UUID\n", vshDebug(ctl, 5, "%s: <%s> trying as network UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
network = virNetworkLookupByUUIDString(ctl->conn, n); network = virNetworkLookupByUUIDString(ctl->conn, n);
@@ -7715,7 +7715,7 @@ vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
*name = n; *name = n;
/* try it by NAME */ /* try it by NAME */
if ((iface == NULL) && (flag & VSH_BYNAME)) { if ((flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n", vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
iface = virInterfaceLookupByName(ctl->conn, n); iface = virInterfaceLookupByName(ctl->conn, n);
@@ -7752,13 +7752,13 @@ vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
*name = n; *name = n;
/* try it by UUID */ /* try it by UUID */
if (pool==NULL && (flag & VSH_BYUUID) && strlen(n)==VIR_UUID_STRING_BUFLEN-1) { if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
vshDebug(ctl, 5, "%s: <%s> trying as pool UUID\n", vshDebug(ctl, 5, "%s: <%s> trying as pool UUID\n",
cmd->def->name, optname); cmd->def->name, optname);
pool = virStoragePoolLookupByUUIDString(ctl->conn, n); pool = virStoragePoolLookupByUUIDString(ctl->conn, n);
} }
/* try it by NAME */ /* try it by NAME */
if (pool==NULL && (flag & VSH_BYNAME)) { if (pool == NULL && (flag & VSH_BYNAME)) {
vshDebug(ctl, 5, "%s: <%s> trying as pool NAME\n", vshDebug(ctl, 5, "%s: <%s> trying as pool NAME\n",
cmd->def->name, optname); cmd->def->name, optname);
pool = virStoragePoolLookupByName(ctl->conn, n); pool = virStoragePoolLookupByName(ctl->conn, n);