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:
+9
-1
@@ -29,6 +29,7 @@
|
||||
#include <getopt.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <library.h>
|
||||
#include <utils/debug.h>
|
||||
@@ -515,11 +516,18 @@ int main(int argc, char **argv)
|
||||
/* write the attribute certificate to file */
|
||||
if (attr_cert->get_encoding(attr_cert, CERT_ASN1_DER, &attr_chunk))
|
||||
{
|
||||
if (chunk_write(attr_chunk, outfile, "attribute cert", 0022, TRUE))
|
||||
if (chunk_write(attr_chunk, outfile, 0022, TRUE))
|
||||
{
|
||||
DBG1(DBG_APP, " written attribute cert file '%s' (%d bytes)",
|
||||
outfile, attr_chunk.len);
|
||||
write_serial(serial);
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1(DBG_APP, " writing attribute cert file '%s' failed: %s",
|
||||
outfile, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user