Blame SOURCES/autofs-5.1.2-fix-included-master-map-not-found-return.patch

304803
autofs-5.1.2 - fix included master map not found return
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
When retrying the master map read at startup a not found return is needed
304803
when there is no map rather than an unknown or unavailable for the retry
304803
logic to work.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG             |    1 +
304803
 daemon/lookup.c       |    6 ++++--
304803
 modules/lookup_file.c |   18 ++++++++++++------
304803
 3 files changed, 17 insertions(+), 8 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -208,6 +208,7 @@
304803
 - add config option to supress not found log message.
304803
 - wait for master map available at start.
304803
 - add master read wait option.
304803
+- fix included master map not found return.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/daemon/lookup.c
304803
+++ autofs-5.0.7/daemon/lookup.c
304803
@@ -241,7 +241,7 @@ int lookup_nss_read_master(struct master
304803
 	}
304803
 
304803
 	/* First one gets it */
304803
-	result = NSS_STATUS_UNKNOWN;
304803
+	result = NSS_STATUS_SUCCESS;
304803
 	head = &nsslist;
304803
 	list_for_each(p, head) {
304803
 		struct nss_source *this;
304803
@@ -282,8 +282,10 @@ int lookup_nss_read_master(struct master
304803
 			}
304803
 		}
304803
 
304803
-		if (result == NSS_STATUS_UNKNOWN) {
304803
+		if (result == NSS_STATUS_UNKNOWN ||
304803
+		    result == NSS_STATUS_NOTFOUND) {
304803
 			debug(logopt, "no map - continuing to next source");
304803
+			result = NSS_STATUS_SUCCESS;
304803
 			continue;
304803
 		}
304803
 
304803
--- autofs-5.0.7.orig/modules/lookup_file.c
304803
+++ autofs-5.0.7/modules/lookup_file.c
304803
@@ -463,6 +463,8 @@ int lookup_read_master(struct master *ma
304803
 
304803
 	f = open_fopen_r(ctxt->mapname);
304803
 	if (!f) {
304803
+		if (errno == ENOENT)
304803
+			return NSS_STATUS_NOTFOUND;
304803
 		error(logopt,
304803
 		      MODPREFIX "could not open master map file %s",
304803
 		      ctxt->mapname);
304803
@@ -506,12 +508,14 @@ int lookup_read_master(struct master *ma
304803
 				     MODPREFIX
304803
 				     "failed to read included master map %s",
304803
 				     master->name);
304803
-				/*
304803
-				 * If we're starting up wee need the whole
304803
-				 * master map initially, so tell the upper
304803
-				 * layer to retry.
304803
-				 */
304803
-				master->read_fail = 1;
304803
+				if (status != NSS_STATUS_NOTFOUND) {
304803
+					/*
304803
+					 * If we're starting up wee need the whole
304803
+					 * master map initially, so tell the upper
304803
+					 * layer to retry.
304803
+					 */
304803
+					master->read_fail = 1;
304803
+				}
304803
 			}
304803
 			master->depth--;
304803
 			master->recurse = 0;
304803
@@ -712,6 +716,8 @@ int lookup_read_map(struct autofs_point
304803
 
304803
 	f = open_fopen_r(ctxt->mapname);
304803
 	if (!f) {
304803
+		if (errno == ENOENT)
304803
+			return NSS_STATUS_NOTFOUND;
304803
 		error(ap->logopt,
304803
 		      MODPREFIX "could not open map file %s", ctxt->mapname);
304803
 		return NSS_STATUS_UNAVAIL;