diff options
Diffstat (limited to 'src/libnpass/libnpass.c')
-rw-r--r-- | src/libnpass/libnpass.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libnpass/libnpass.c b/src/libnpass/libnpass.c index 6618385..6c66a79 100644 --- a/src/libnpass/libnpass.c +++ b/src/libnpass/libnpass.c @@ -265,7 +265,7 @@ int pass_init(const char *fpr) err_ret(1, "PASSWORD_STORE_DIR not set"); r = gpg_key_validate(fpr); - if (r) + if (r < 0) err_ret(1, "key not usable, try gpg --full-generate-key"); r = r_mkdir(pass_dir, S_IRWXU); @@ -308,7 +308,7 @@ int pass_cat(FILE *out, const char *path) err_ret(1, "failed to build path"); r = gpg_decrypt(out, pass_path); - return r; + return (r < 0) ? 1 : r; } ssize_t pass_getpass(char **lineptr, size_t *n, FILE *stream) @@ -386,7 +386,7 @@ int pass_add(const char *path, const char *pass, size_t n) util_strtrim(fpr); r = gpg_key_validate(fpr); - if (r) + if (r < 0) err_ret(1, "invalid key , try gpg --list-keys"); /* TODO: guard against .*\.gpg\.gpg[/$] */ @@ -411,7 +411,7 @@ int pass_add(const char *path, const char *pass, size_t n) r = gpg_encrypt(out_stream, fpr, pass, n); fclose(out_stream); - return r; + return (r < 0) ? 1 : r; } int pass_rm(const char *path) |