aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2024-04-19 08:09:29 +0530
committersinanmohd <sinan@sinanmohd.com>2024-04-19 08:09:45 +0530
commitc2607c2f5263e1f03bbdbbe348195045490dc5ce (patch)
tree658297e05961ac376513189822978018916f0490
parent68c5a4cc9ee5aff617b5e80abe1bd3dcb68e3052 (diff)
libnpass/openstore: use int instead of pass_store_t for error handling
-rw-r--r--src/libnpass/libnpass.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libnpass/libnpass.c b/src/libnpass/libnpass.c
index c04a2ab..1917db6 100644
--- a/src/libnpass/libnpass.c
+++ b/src/libnpass/libnpass.c
@@ -156,19 +156,18 @@ int pass_store_type(const char *spath)
static int openstore(const char *spath, DIR **dirp)
{
- pass_store_t store_type;
char abs_path[PATH_MAX];
const char *path;
- int r;
+ int ret;
- store_type = pass_store_type(spath);
- if (store_type != PASS_STORE_DIR)
- return (store_type < 0) ? store_type : -EINVAL;
+ ret = pass_store_type(spath);
+ if (ret != PASS_STORE_DIR)
+ return (ret < 0) ? ret : -EINVAL;
if (spath) {
- r = snprintf(abs_path, sizeof(abs_path), "%s/%s", pass_dir,
- spath);
- if (r < 0 || (size_t)r >= sizeof(abs_path))
+ ret = snprintf(abs_path, sizeof(abs_path), "%s/%s", pass_dir,
+ spath);
+ if (ret < 0 || (size_t)ret >= sizeof(abs_path))
return_err(-ENAMETOOLONG, "Path exceeded PATH_MAX");
path = abs_path;