summaryrefslogtreecommitdiffstats
path: root/misc/orville-write/files/patch-helpers.c
blob: 3fc7bf2d286e297a18044063efbda0d329ff8a78 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--- helpers.c.orig	2000-02-20 09:28:08.000000000 -0800
+++ helpers.c	2010-02-02 23:20:25.434811144 -0800
@@ -11,7 +11,7 @@
 
 struct hlp {
 	time_t time;			/* login time from wrttmp file */
-	char line[UT_LINESIZE];		/* ttyline occupied by a helper */
+	char line[sizeof(((struct utmpx *)0)->ut_line) -1];		/* ttyline occupied by a helper */
 	int busy;			/* is he busy? */
 	struct hlp *next;		/* next helper */
 	} *list= NULL;
@@ -27,7 +27,7 @@
 
     for (curr= list, prev= NULL; curr != NULL; prev= curr,curr= prev->next)
     {
-	if (!strncmp(tty, curr->line, UT_LINESIZE))
+	if (!strncmp(tty, curr->line, ((struct utmpx *)0)->ut_line -1))
 	{
 	    if (prev == NULL)
 	    	list= curr->next;
@@ -47,7 +47,7 @@
 int perms_on(struct wrttmp *w)
 {
 struct stat st;
-char devname[UT_LINESIZE+7];
+char devname[sizeof(((struct utmpx *)0)->ut_line) +6];
 
 #ifdef TTYPERMS
 #define MASK 022
@@ -59,7 +59,7 @@
 
     /* Is his tty physically writable? */
 
-    sprintf(devname,"/dev/%.*s",UT_LINESIZE,w->wrt_line);
+    sprintf(devname,"/dev/%.*s",((struct utmpx *)0)->ut_line -1,w->wrt_line);
     if (stat(devname,&st))
     	return(0);
 
@@ -72,7 +72,7 @@
 FILE *fp;
 struct wrttmp w;
 struct wrthdr wt_head;
-struct utmp *u;
+struct utmpx *u;
 struct hlp *tmp;
 int i, j;
 int slot= 0;
@@ -146,7 +146,7 @@
     if (list != NULL)
     {
     	/* Do the scan */
-	while ((u= getutent()) != NULL)
+	while ((u= getutxent()) != NULL)
     	{
 #ifdef USER_PROCESS
 	    if (u->ut_type != USER_PROCESS)
@@ -155,15 +155,15 @@
 	    if ((tmp= findlist(u->ut_line)) != NULL)
 	    {
 	    	/* If the time stamps don't match, this isn't a real helper */
-	    	if (u->ut_time == tmp->time)
+	    	if (u->ut_tv.tv_sec == tmp->time)
 	    	{
 		    /* Found a real helper -- count and print */
 		    count++;
 
 		    if (listthem)
 			printf("%-*.*s %-*.*s%s\n",
-			    UT_NAMESIZE, UT_NAMESIZE, u->ut_name,
-			    UT_LINESIZE, UT_LINESIZE, u->ut_line,
+			    sizeof(u->ut_user)-1, sizeof(u->ut_user)-1, u->ut_user,
+			    sizeof(u->ut_line)-1, sizeof(u->ut_user)-1, u->ut_line,
 			    tmp->busy ? " [busy]" : "");
 
 	    	}
@@ -172,7 +172,7 @@
 	    }
     	}
 
-    	endutent();
+    	endutxent();
     }
 
     if (!listthem)
OpenPOWER on IntegriCloud