summaryrefslogtreecommitdiff
path: root/user/physlock/utmps.patch
blob: efae166a93250c77fa67740626553a4f31dd8981 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- physlock-11/auth.c	2017-07-13 07:23:52.000000000 +0000
+++ physlock-11/auth.c	2018-09-21 21:21:36.240024566 +0000
@@ -16,13 +16,14 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#define _GNU_SOURCE
 #include <paths.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <pwd.h>
 #include <unistd.h>
-#include <utmp.h>
+#include <utmpx.h>
 #include <errno.h>
 #include <security/pam_misc.h>
 
@@ -41,12 +42,12 @@ static void get_pam(userinfo_t *uinfo) {
 
 void get_user(userinfo_t *uinfo, int vt, uid_t owner) {
 	FILE *uf;
-	struct utmp r;
+	struct utmpx r;
 	struct passwd *pw;
 	char tty[16], name[UT_NAMESIZE+1];
 
 	uinfo->name = NULL;
-	while ((uf = fopen(_PATH_UTMP, "r")) == NULL && errno == EINTR);
+	while ((uf = fopen(UTMPX_FILE, "r")) == NULL && errno == EINTR);
 
 	if (uf != NULL) {
 		snprintf(tty, sizeof(tty), "tty%d", vt);