File: linux-ps-longusernames.patch

package info (click to toggle)
killer 0.90-15
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 764 kB
  • sloc: perl: 8,785; makefile: 35; sh: 1
file content (19 lines) | stat: -rw-r--r-- 706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Description: Improve handling of long usernames on Linux,
 where ps will print the uid if the username is more than 8 characters logn.
Author: Petter Reinholdtsen 2008-07-06

--- killer-git.orig/killer	2014-09-28 09:00:41.287981677 +0200
+++ killer-git/killer	2014-09-28 09:00:41.507983499 +0200
@@ -238,7 +238,11 @@
 
 	($user, $ruser, $uid, $ruid, $tty, $pid, $ppid, $nice, $comm) 
 		= split( /[ \t]+/, $_, 9 );
-	
+
+        # Linux ps report uid when username is longer than 8 characters.
+        $user = (getpwuid($user))[0] if ($user =~ m/^\d+/);
+        $ruser = (getpwuid($ruser))[0] if ($ruser =~ m/^\d+/);
+
 	$pid2user{$pid} = $user;
 	$pid2ruser{$pid} = $ruser;
 	$pid2uid{$pid} = int $uid;