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