From 621da582c25cae708a6f7eb8a5394d3ed3b19cfd Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Fri, 5 Mar 2021 10:10:45 +0100 Subject: [PATCH] Fix obvious bug in ismnt() found by Coverity Scan Signed-off-by: Joachim Wiberg --- src/helpers.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/helpers.c b/src/helpers.c index 48c3bcf6..17b4d793 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -563,10 +563,12 @@ int ismnt(char *file, char *dir, char *mode) while ((mnt = getmntent(fp))) { if (!strcmp(mnt->mnt_dir, dir)) { - if (mode && hasopt(mnt->mnt_opts, mode)) - found = 1; - else + if (mode) { + if (hasopt(mnt->mnt_opts, mode)) + found = 1; + } else found = 1; + break; } }