File autofs-5.0.6-fix-yp-map-age-not-updated-in-s-_-.-g-case.patch of Package autofs.3485

From d5570743b066ce28a0e486167a30fa5137eb2126 Mon Sep 17 00:00:00 2001
From: Jeff Mahoney <jeffm@suse.com>
Date: Tue, 3 May 2016 21:06:54 -0400
Subject: [PATCH 1/2] autofs: fix yp map age not updated in s/_/./g case
References: bsc#968918
Patch-mainline: 5.1.2
Git-commit: 11fafab0bd1cc7682c55a7898f0e3652997fd3c5

The map source age field should be updated when we retry
the yp map lookup using dots instead of underscores.

Rather than just open code the exit path, just reverse the logic for
returning success so we only have one success path for both cases.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Ian Kent <raven@themaw.net>
---
 modules/lookup_yp.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index eda2aba..502d850 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -431,17 +431,16 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
 			err = yp_all((char *) ctxt->domainname, mapname, &ypcb);
 		}
 
-		if (err == YPERR_SUCCESS)
-			return NSS_STATUS_SUCCESS;
+		if (err != YPERR_SUCCESS) {
+			warn(ap->logopt,
+			     MODPREFIX "read of map %s failed: %s",
+			     ap->path, yperr_string(err));
 
-		warn(ap->logopt,
-		     MODPREFIX "read of map %s failed: %s",
-		     ap->path, yperr_string(err));
+			if (err == YPERR_PMAP || err == YPERR_YPSERV)
+				return NSS_STATUS_UNAVAIL;
 
-		if (err == YPERR_PMAP || err == YPERR_YPSERV)
-			return NSS_STATUS_UNAVAIL;
-
-		return NSS_STATUS_NOTFOUND;
+			return NSS_STATUS_NOTFOUND;
+		}
 	}
 
 	source->age = age;
-- 
2.7.1