From b28842ae67557f503ae097d5101cbe0a93fda39d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 5 Mar 2015 12:25:28 +0100 Subject: agetty: support /usr/lib/os-release too http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov Signed-off-by: Karel Zak --- term-utils/agetty.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'term-utils/agetty.c') diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 7c97faffa..0d7bd1db7 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -1444,10 +1444,13 @@ static char *read_os_release(struct options *op, const char *varname) /* read the file only once */ if (!op->osrelease) { - fd = open(_PATH_OS_RELEASE, O_RDONLY); + fd = open(_PATH_OS_RELEASE_ETC, O_RDONLY); if (fd == -1) { - log_warn(_("cannot open %s: %m"), _PATH_OS_RELEASE); - return NULL; + fd = open(_PATH_OS_RELEASE_USR, O_RDONLY); + if (fd == -1) { + log_warn(_("cannot open os-release file")); + return NULL; + } } if (fstat(fd, &st) < 0 || st.st_size > 4 * 1024 * 1024) -- cgit v1.2.3-55-g7522