]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
agetty: use configured run state directory
authorSami Kerola <kerolasa@iki.fi>
Sat, 23 Jun 2012 07:02:36 +0000 (09:02 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Jul 2012 11:00:20 +0000 (13:00 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include/pathnames.h
term-utils/agetty.c

index ba8de0111094a950dc1752ae5dfc41d023ac9818..d0ed7a1584506211c17e4960a7e53997c4fc075a 100644 (file)
@@ -63,6 +63,7 @@
 
 /* used in term-utils/agetty.c */
 #define _PATH_ISSUE            "/etc/issue"
+#define _PATH_NUMLOCK_ON       _PATH_LOCALSTATEDIR "/numlock-on"
 
 #define _PATH_LOGINDEFS                "/etc/login.defs"
 
index 7514015f65596ae96fa0b2439531ca7514f3158f..5c445df5bd45361e09f82eecc54cec386f021ae0 100644 (file)
@@ -1259,9 +1259,8 @@ static void do_prompt(struct options *op, struct termios *tp)
                if (ioctl(STDIN_FILENO, KDGKBLED, &kb) == 0) {
                        char hint[256] = { '\0' };
                        int nl = 0;
-                       struct stat st;
 
-                       if (stat("/var/run/numlock-on", &st) == 0)
+                       if (access(_PATH_NUMLOCK_ON, F_OK) == 0)
                                nl = 1;
 
                        if (nl && (kb & 0x02) == 0)