mirror of
https://github.com/libvirt/libvirt.git
synced 2025-01-24 15:26:40 -06:00
Fix assignment of comparison against zero
Assign the value we're comparing: (val = func()) < 0 instead of assigning the comparison value: (val = func() < 0) Both were introduced along with the code, the TLS tests by commitbd789df
in 0.9.4 net events by commitde87691
in 1.2.2. Note that the event id type fix is a no-op: vshNetworkEventIdTypeFromString can only return -1 (failure) and the event is never used or 0 (the only possible event) and the value of 0 < 0 is still 0.
This commit is contained in:
parent
d7dedc3650
commit
3103a9770f
@ -383,7 +383,7 @@ testTLSGenerateCert(struct testTLSCertReq *req,
|
|||||||
* If no 'ca' is set then we are self signing
|
* If no 'ca' is set then we are self signing
|
||||||
* the cert. This is done for the root CA certs
|
* the cert. This is done for the root CA certs
|
||||||
*/
|
*/
|
||||||
if ((err = gnutls_x509_crt_sign(crt, ca ? ca : crt, privkey) < 0)) {
|
if ((err = gnutls_x509_crt_sign(crt, ca ? ca : crt, privkey)) < 0) {
|
||||||
VIR_WARN("Failed to sign certificate %s", gnutls_strerror(err));
|
VIR_WARN("Failed to sign certificate %s", gnutls_strerror(err));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ testTLSGenerateCert(struct testTLSCertReq *req,
|
|||||||
/*
|
/*
|
||||||
* Finally write the new cert out to disk
|
* Finally write the new cert out to disk
|
||||||
*/
|
*/
|
||||||
if ((err = gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM, buffer, &size) < 0)) {
|
if ((err = gnutls_x509_crt_export(crt, GNUTLS_X509_FMT_PEM, buffer, &size)) < 0) {
|
||||||
VIR_WARN("Failed to export certificate %s", gnutls_strerror(err));
|
VIR_WARN("Failed to export certificate %s", gnutls_strerror(err));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
@ -1238,7 +1238,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
vshError(ctl, "%s", _("either --list or event type is required"));
|
vshError(ctl, "%s", _("either --list or event type is required"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((event = vshNetworkEventIdTypeFromString(eventName) < 0)) {
|
if ((event = vshNetworkEventIdTypeFromString(eventName)) < 0) {
|
||||||
vshError(ctl, _("unknown event type %s"), eventName);
|
vshError(ctl, _("unknown event type %s"), eventName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user