From 886d57f5c7d4cdbb0daf252e3aa60a00dd08a9c9 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Fri, 26 Aug 2022 14:42:00 +0300 Subject: routines: replace errprint_*() with print_error() This is one of the steps on the way to get rid of errprint_*() macros and handle errors by yourself. For more context see other patches under the same topic specified below. TOPIC=drop_errprint --- src/routines.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/routines.c b/src/routines.c index 1e85132..b2cd59f 100644 --- a/src/routines.c +++ b/src/routines.c @@ -92,14 +92,17 @@ char *get_pubkey() FILE *fileGPG = fopen(".gpg-key", "r"); if(fileGPG == NULL) { if(errno == ENOENT) - errprint_r(NULL, "No GPG key exists. Use \"lpass init\"\n"); - errprint_r(NULL, "%s\n", strerror(errno)); + print_error("Error: No GPG key exists. Use \"lpass init\"\n"); + else + print_error("Error: %s\n", strerror(errno)); + return NULL; } pubkey = malloc(sizeof(char) * (maxlen_fingerprint + 1)); if(fgets(pubkey, maxlen_fingerprint + 1, fileGPG) == NULL) { + print_error("Error: %s\n", strerror(errno)); free(pubkey); - errprint_ptr(&pubkey, NULL, "%s\n", strerror(errno)); + pubkey = NULL; } fclose(fileGPG); -- cgit v1.2.3-18-g5258