summaryrefslogtreecommitdiffstats
path: root/term-utils/agetty.c
diff options
context:
space:
mode:
authorKarel Zak2015-03-05 12:25:28 +0100
committerKarel Zak2015-03-05 12:25:28 +0100
commitb28842ae67557f503ae097d5101cbe0a93fda39d (patch)
tree696c66e2d69af31ab0e4f1eebbfb7ed47616db9d /term-utils/agetty.c
parentMerge branch 'logger-fix-rfc5424-timestamp' of https://github.com/rgerhards/u... (diff)
downloadkernel-qcow2-util-linux-b28842ae67557f503ae097d5101cbe0a93fda39d.tar.gz
kernel-qcow2-util-linux-b28842ae67557f503ae097d5101cbe0a93fda39d.tar.xz
kernel-qcow2-util-linux-b28842ae67557f503ae097d5101cbe0a93fda39d.zip
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 <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'term-utils/agetty.c')
-rw-r--r--term-utils/agetty.c9
1 files changed, 6 insertions, 3 deletions
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)