chunk: Externalize error reporting in chunk_write()

This avoids passing that arbitrary label just for error messages, and gives
greater flexibility in handling errors.
This commit is contained in:
Martin Willi
2014-01-23 15:55:32 +01:00
parent 37374a292a
commit b9ee059ca9
6 changed files with 52 additions and 30 deletions
+10 -1
View File
@@ -521,7 +521,16 @@ METHOD(stroke_cred_t, cache_cert, void,
if (cert->get_encoding(cert, CERT_ASN1_DER, &chunk))
{
chunk_write(chunk, buf, "crl", 022, TRUE);
if (chunk_write(chunk, buf, 022, TRUE))
{
DBG1(DBG_CFG, " written crl file '%s' (%d bytes)",
buf, chunk.len);
}
else
{
DBG1(DBG_CFG, " writing crl file '%s' failed: %s",
buf, strerror(errno));
}
free(chunk.ptr);
}
}