Blob Blame History Raw
autofs-5.1.7 - Fix option for master read wait

From: Goldwyn Rodrigues <rgoldwyn@suse.de>

The master-wait program option expects a value, and if provided
automount crashes with the following trace:

#0  __GI_____strtoul_l_internal (nptr=0x0, endptr=0x7fffffffe120, base=0, group=<optimized out>,
    loc=0x7ffff77a63a0 <_nl_global_locale>) at ../stdlib/strtol_l.c:292
#1  0x0000555555562c52 in getnumopt ()
#2  0x0000555555564ec0 in main ()

This is because the options string is not correct and does not expect
an argument for master-wait (M), which sets optarg to NULL.

Fixes: e68f07f ("autofs-5.1.2 - add master read wait option")
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG          |    1 +
 daemon/automount.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index fe49740e..0b577909 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
 - dont use realloc in host exports list processing.
 - use sprintf() when constructing hosts mapent.
 - fix mnts_remove_amdmount() uses wrong list.
+- Fix option for master read wait.
 
 25/01/2021 autofs-5.1.7
 - make bind mounts propagation slave by default.
diff --git a/daemon/automount.c b/daemon/automount.c
index e476f6b2..7fa92877 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -2274,7 +2274,7 @@ int main(int argc, char *argv[])
 	time_t timeout;
 	time_t age = monotonic_time(NULL);
 	struct rlimit rlim;
-	const char *options = "+hp:t:vmdD:SfVrO:l:n:CFUM";
+	const char *options = "+hp:t:vmdD:SfVrO:l:n:CFUM:";
 	static const struct option long_options[] = {
 		{"help", 0, 0, 'h'},
 		{"pid-file", 1, 0, 'p'},