dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
5f5089
From 6b70da7e86ae17c215c48156a59e76b9f89e8add Mon Sep 17 00:00:00 2001
5f5089
From: Karel Zak <kzak@redhat.com>
5f5089
Date: Thu, 5 Oct 2017 11:07:41 +0200
5f5089
Subject: [PATCH 127/135] agetty: fix /etc/os-release parsing
5f5089
5f5089
For example /etc/os-release:
5f5089
5f5089
	VERSION="26 (Twenty Six)"
5f5089
	VERSION_ID=26
5f5089
5f5089
agetty for \S{VERSION} returns
5f5089
5f5089
	_ID=26
5f5089
5f5089
because the parser does nor check for '=' after variable name.
5f5089
5f5089
Upstream: http://github.com/karelzak/util-linux/commit/949e83997906ab8dd8442f28d74c34bb5a2395ee
5f5089
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1498462
5f5089
Signed-off-by: Karel Zak <kzak@redhat.com>
5f5089
---
5f5089
 term-utils/agetty.c | 6 ++++++
5f5089
 1 file changed, 6 insertions(+)
5f5089
5f5089
diff --git a/term-utils/agetty.c b/term-utils/agetty.c
5f5089
index 5692126dd..b626cdbeb 100644
5f5089
--- a/term-utils/agetty.c
5f5089
+++ b/term-utils/agetty.c
5f5089
@@ -1280,6 +1280,7 @@ static char *xgetdomainname(void)
5f5089
 	return NULL;
5f5089
 }
5f5089
 
5f5089
+
5f5089
 static char *read_os_release(struct options *op, const char *varname)
5f5089
 {
5f5089
 	int fd = -1;
5f5089
@@ -1329,6 +1330,11 @@ static char *read_os_release(struct options *op, const char *varname)
5f5089
 			continue;
5f5089
 		}
5f5089
 		p += varsz;
5f5089
+		p += strspn(p, " \t\n\r");
5f5089
+
5f5089
+		if (*p != '=')
5f5089
+			continue;
5f5089
+
5f5089
 		p += strspn(p, " \t\n\r=\"");
5f5089
 		eol = p + strcspn(p, "\n\r");
5f5089
 		*eol = '\0';
5f5089
-- 
5f5089
2.13.6
5f5089