summaryrefslogtreecommitdiffstats
path: root/usr.sbin/autofs
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-08-23 11:51:46 +0000
committertrasz <trasz@FreeBSD.org>2014-08-23 11:51:46 +0000
commit70e59e5f25bda6a3ba9ed938a3be5f538e570875 (patch)
tree14932ac3e2e299049bc4b340b8034b72ee09eb6e /usr.sbin/autofs
parent1fb20eb09541dfd6a18ed0d66677733ad26447ea (diff)
downloadFreeBSD-src-70e59e5f25bda6a3ba9ed938a3be5f538e570875.zip
FreeBSD-src-70e59e5f25bda6a3ba9ed938a3be5f538e570875.tar.gz
Don't fail on executable maps that return no entries. This turns useless
error message into useful one. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin/autofs')
-rw-r--r--usr.sbin/autofs/common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/autofs/common.c b/usr.sbin/autofs/common.c
index 7dffd95..205d152 100644
--- a/usr.sbin/autofs/common.c
+++ b/usr.sbin/autofs/common.c
@@ -716,7 +716,13 @@ parse_map_yyin(struct node *parent, const char *map, const char *executable_key)
for (;;) {
ret = yylex();
if (ret == 0 || ret == NEWLINE) {
- if (key != NULL || options != NULL) {
+ /*
+ * In case of executable map, the key is always
+ * non-NULL, even if the map is empty. So, make sure
+ * we don't fail empty maps here.
+ */
+ if ((key != NULL && executable_key == NULL) ||
+ options != NULL) {
log_errx(1, "truncated entry at %s, line %d",
map, lineno);
}
OpenPOWER on IntegriCloud