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

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