From c2607c2f5263e1f03bbdbbe348195045490dc5ce Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Fri, 19 Apr 2024 08:09:29 +0530 Subject: libnpass/openstore: use int instead of pass_store_t for error handling --- src/libnpass/libnpass.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/libnpass/libnpass.c') 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; -- cgit v1.2.3