From 3b1ccce5151c7ad771a20b2cd602663fa44a4373 Mon Sep 17 00:00:00 2001 From: Michael Holzheu Date: Thu, 4 Oct 2018 18:16:55 +0200 Subject: [PATCH] util_proc: Fix return code handling for util_proc_mnt_get_entry() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correctly return -1 if the requested file system is not mounted. Reported-by: Peter Morjan Signed-off-by: Michael Holzheu Signed-off-by: Jan Höppner --- libutil/util_proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libutil/util_proc.c b/libutil/util_proc.c index 5df33d89..9e524041 100644 --- a/libutil/util_proc.c +++ b/libutil/util_proc.c @@ -456,7 +456,6 @@ int util_proc_mnt_get_entry(const char *file_name, const char *spec, rc = get_file_buffer(&file, file_name); if (rc) return rc; - rc = -1; while (!eof(&file)) { rc = scan_mnt_entry(&file, entry); if (rc) @@ -467,6 +466,7 @@ int util_proc_mnt_get_entry(const char *file_name, const char *spec, } util_proc_mnt_free_entry(entry); } + rc = -1; out_free: free_file_buffer(&file); return rc;