From 58fea0ea98ed7145f15acc851b8dbaa17e111ebd Mon Sep 17 00:00:00 2001
From: Rob Landley <rob@landley.net>
Date: Tue, 11 Jul 2017 05:16:09 -0500
Subject: comma_scan()'s clean option wasn't removing entry at end of list.

---
 lib/getmountlist.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/getmountlist.c b/lib/getmountlist.c
index 332852a8..f7d58ab6 100644
--- a/lib/getmountlist.c
+++ b/lib/getmountlist.c
@@ -97,7 +97,10 @@ int comma_scan(char *optlist, char *opt, int clean)
     no = 2*(*s == 'n' && s[1] == 'o');
     if (optlen == len-no && !strncmp(opt, s+no, optlen)) {
       got = !no;
-      if (clean && optlist) memmove(s, optlist, strlen(optlist)+1);
+      if (clean) {
+        if (optlist) memmove(s, optlist, strlen(optlist)+1);
+        else *s = 0;
+      }
     }
   }
 
-- 
cgit v1.2.3