autofs-5.0.3 - don't readmap on HUP for new mount

From: Ian Kent <raven@themaw.net>

If we're performin a new mount during a HUP signal then
we will read the map during the mount.
---

 CHANGELOG    |    1 +
 lib/master.c |    7 ++++---
 2 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/CHANGELOG b/CHANGELOG
index 249cf80..7f3c0d3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -38,6 +38,7 @@
 - update kernel patches.
 - fix fd leak at multi-mount non-fatal mount fail.
 - fix incorrect multi-mount mountpoint calcualtion.
+- fix map out of order map re-read on hup signal.
  
 14/01/2008 autofs-5.0.3
 -----------------------
diff --git a/lib/master.c b/lib/master.c
index d971ad6..13302f1 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -1108,8 +1108,6 @@ int master_mount_mounts(struct master *master, time_t age, int readall)
 		}
 		cache_unlock(nc);
 
-		check_update_map_sources(this, readall);
-
 		st_mutex_lock();
 
 		state_pipe = this->ap->state_pipe[1];
@@ -1120,11 +1118,14 @@ int master_mount_mounts(struct master *master, time_t age, int readall)
 
 		st_mutex_unlock();
 
-		if (ret == -1 && save_errno == EBADF)
+		if (!ret)
+			check_update_map_sources(this, readall);
+		else if (ret == -1 && save_errno == EBADF) {
 			if (!master_do_mount(this)) {
 				list_del_init(&this->list);
 				master_free_mapent_sources(ap->entry, 1);
 				master_free_mapent(ap->entry);
+			}
 		}
 	}