1
Fixed chkutmp parser, thanks to Aaron M. Ucko
4
@@ -58,9 +58,9 @@ int main () { return 0; }
8
- char ps_tty[UT_LINESIZE];
9
- char ps_user[UT_NAMESIZE];
10
- char ps_args[MAXLENGTH];
11
+ char ps_tty[UT_LINESIZE+2];
12
+ char ps_user[UT_NAMESIZE+2];
13
+ char ps_args[MAXLENGTH+2];
17
@@ -70,7 +70,7 @@ struct utmp_line {
19
static char *cmd[] = {
20
"ps -ef -o \"tty,pid,ruser,args\"", /* solaris */
21
- "ps ax -o \"tty,pid,ruser,args\"" /* linux */
22
+ "ps axk \"tty,ruser,args\" -o \"tty,pid,ruser,args\"" /* linux */
24
int fetchps(struct ps_line *);
25
int fetchutmp(struct utmp_line *);
26
@@ -113,6 +113,8 @@ int fetchps(struct ps_line *psl_p)
28
for (x = 0; (*d++ = *s++) && x <= MAXLENGTH; x++) /* cmd + args */
35
@@ -202,7 +204,7 @@ int main(int argc, char *argv[])
39
- printf("! %-9s %7d %-6s %s", ps_l[h].ps_user,
40
+ printf("! %-9s %7d %-6s %s\n", ps_l[h].ps_user,
41
ps_l[h].ps_pid, ps_l[h].ps_tty, ps_l[h].ps_args);