diff options
author | Joursoir <chat@joursoir.net> | 2022-08-26 14:42:00 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-08-26 21:00:29 +0300 |
commit | 886d57f5c7d4cdbb0daf252e3aa60a00dd08a9c9 (patch) | |
tree | f5ef196e56f8621a7d1acb5f2f4d6c79aa29e42d | |
parent | 85b4b0d67cc69a2b9440091f9634f2fa04b7ffea (diff) | |
download | lock-password-886d57f5c7d4cdbb0daf252e3aa60a00dd08a9c9.tar.gz lock-password-886d57f5c7d4cdbb0daf252e3aa60a00dd08a9c9.tar.bz2 lock-password-886d57f5c7d4cdbb0daf252e3aa60a00dd08a9c9.zip |
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
-rw-r--r-- | src/routines.c | 9 |
1 files 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); |