diff options
-rw-r--r-- | src/libnpass/libnpass.c | 24 | ||||
-rw-r--r-- | src/npass/npass.c | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/libnpass/libnpass.c b/src/libnpass/libnpass.c index 1917db6..513b739 100644 --- a/src/libnpass/libnpass.c +++ b/src/libnpass/libnpass.c @@ -150,7 +150,7 @@ int pass_store_type(const char *spath) if ((sbuf.st_mode & S_IFMT) == S_IFREG) { return PASS_STORE_ENC; } else { - return_err(-EINVAL, "%s Not a regular file", abs_path); + return_err(-EINVAL, "Not a regular file: %s", abs_path); } } @@ -267,11 +267,11 @@ int pass_init(const char *fpr) r = gpg_key_validate(fpr); if (r < 0) - return_err(r, "Try gpg --full-generate-key"); + return_err(r, "Try `gpg --full-generate-key`"); r = r_mkdir(pass_dir, S_IRWXU); if (r < 0) - return_err(r, "%s %s", pass_dir, strerror(errno)); + return_err(r, "%s: %s", strerror(errno), pass_dir); r = snprintf(gpg_id_path, sizeof(gpg_id_path), "%s/%s", pass_dir, ".gpg-id"); @@ -280,13 +280,13 @@ int pass_init(const char *fpr) gpg_id = fopen(gpg_id_path, "w"); if (!gpg_id) - return_err(-errno, "%s %s", gpg_id_path, strerror(errno)); + return_err(-errno, "%s: %s", strerror(errno), gpg_id_path); fpr_len = strlen(fpr); r = fwrite(fpr, sizeof(*fpr), fpr_len, gpg_id); fclose(gpg_id); if (r != fpr_len) - return_err(-EPERM, "%s %s", gpg_id_path, "Write failed"); + return_err(-EIO, "Failed to write: %s", gpg_id_path); return 0; } @@ -300,7 +300,7 @@ int pass_cat(FILE *out, const char *path) if (ret < 0) return ret; if (ret != PASS_STORE_ENC) - return_err(-EINVAL, "%s is Not a password", path); + return_err(-EINVAL, "Not a password: %s", path); ret = snprintf(pass_path, sizeof(pass_path), "%s/%s.gpg", pass_dir, path); @@ -359,7 +359,7 @@ int pass_gen(pass_gen_t gen, char *pass, int len) ret = fread(pass, sizeof(pass[0]), len, rand); if (ret != len) - return_err(-EPERM, "Failed to read /dev/urandom"); + return_err(-EPERM, "Failed to read: /dev/urandom"); pass_gen_len = strlen(pass_gen_set[gen]); for (int i = 0; i < len; i++) @@ -386,17 +386,17 @@ int pass_add(const char *path, const char *pass, size_t n) gpg_id = fopen(gpg_id_path, "r"); if (!gpg_id) - return_err(-errno, "%s %s", gpg_id_path, strerror(errno)); + return_err(-errno, "%s: %s", strerror(errno), gpg_id_path); p = fgets(fpr, sizeof(fpr), gpg_id); if (!p) - return_err(-EPERM, "Failed to read %s", gpg_id_path); + return_err(-EPERM, "Failed to read: %s", gpg_id_path); fclose(gpg_id); util_strtrim(fpr); ret = gpg_key_validate(fpr); if (ret < 0) - return_err(ret, "Invalid key , try gpg --list-keys"); + return_err(ret, "Invalid key: Try `gpg --list-keys`"); /* TODO: guard against .*\.gpg\.gpg[/$] */ ret = snprintf(pass_path, sizeof(pass_path), "%s/%s.gpg", pass_dir, @@ -411,7 +411,7 @@ int pass_add(const char *path, const char *pass, size_t n) errno = 0; ret = access(pass_path, F_OK); if (errno != ENOENT) - return_err(-EEXIST, "%s %s", path, strerror(EEXIST)); + return_err(-errno, "%s: %s", strerror(errno), path); out_stream = fopen(pass_path, "w"); if (!out_stream) @@ -443,7 +443,7 @@ int pass_rm(const char *path) /* TODO: guard against .*\.gpg\.gpg[/$] */ ret = unlink(abs_path); if (ret < 0) - return_err(-errno, "%s %s", abs_path, strerror(errno)); + return_err(-errno, "%s: %s", strerror(errno), abs_path); return r_rmdir_empty(pass_dir, dirname(gpg_path)); } diff --git a/src/npass/npass.c b/src/npass/npass.c index 5f3ba6e..54b0f06 100644 --- a/src/npass/npass.c +++ b/src/npass/npass.c @@ -8,7 +8,7 @@ #include "util.h" #define return_invalid_usage(err) \ - return_err(err, "%s", "Invalid usage, try `pass help`") + return_err(err, "%s", "Invalid usage: Try `pass help`") #define DEF_DEPTH 16 #define BLUE "\e[0;34m" |