提交 d1f144d6 编写于 作者: E Eric Blake 提交者: Daniel Veillard

tests: detect gnutls errors

* tests/virnettlscontexttest.c (testTLSLoadKey): Report errors.
上级 2fdf2173
......@@ -410,10 +410,18 @@ static gnutls_x509_privkey_t testTLSLoadKey(void)
{
gnutls_x509_privkey_t key;
const gnutls_datum_t data = { (unsigned char *)PRIVATE_KEY, strlen(PRIVATE_KEY) };
int err;
gnutls_x509_privkey_init(&key);
if ((err = gnutls_x509_privkey_init(&key)) < 0) {
VIR_WARN("Failed to init key %s", gnutls_strerror(err));
abort();
}
gnutls_x509_privkey_import(key, &data, GNUTLS_X509_FMT_PEM);
if ((err = gnutls_x509_privkey_import(key, &data,
GNUTLS_X509_FMT_PEM)) < 0) {
VIR_WARN("Failed to init key %s", gnutls_strerror(err));
abort();
}
return key;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册