summaryrefslogtreecommitdiff
path: root/src/pki/commands/req.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pki/commands/req.c')
-rw-r--r--src/pki/commands/req.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pki/commands/req.c b/src/pki/commands/req.c
index 628463e7b..5b2c128b7 100644
--- a/src/pki/commands/req.c
+++ b/src/pki/commands/req.c
@@ -16,6 +16,7 @@
*/
#include <time.h>
+#include <errno.h>
#include "pki.h"
@@ -118,7 +119,12 @@ static int req()
{
chunk_t chunk;
- chunk = chunk_from_fd(0);
+ if (!chunk_from_fd(0, &chunk))
+ {
+ fprintf(stderr, "reading private key failed: %s\n", strerror(errno));
+ error = "";
+ goto end;
+ }
private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, type,
BUILD_BLOB, chunk, BUILD_END);
free(chunk.ptr);