]> granicus.if.org Git - psmisc/commitdiff
pstree scanf fixed for uClibc
authorCraig Small <csmall@users.sourceforge.net>
Mon, 2 May 2005 06:47:21 +0000 (06:47 +0000)
committerCraig Small <csmall@users.sourceforge.net>
Mon, 2 May 2005 06:47:21 +0000 (06:47 +0000)
ChangeLog
src/pstree.c

index 7797f2d115de831e07f6959c057cb6fc43e3304b..827349c1b1aa5f19c852834f921196af63c86858 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ Changes in 21.7
        * fusernew - this will be the new fuser once it gets tested on
          those strange setups folks out there have
        * Completed change from Flask to SELinux, thanks to Benno Schulenberg
+       * pstree works better with uClibc, thanks Mike Frysinger
 
 Changes in 21.6
 ===============
index 481a5d35c665da718ae310472c46d28cc50e5e2d..f11816162ac660d07e4c0b677b62eef76845a4d5 100644 (file)
@@ -531,6 +531,9 @@ dump_by_user (PROC * current, uid_t uid)
 {
   const CHILD *walk;
 
+  if (!current)
+    return;
+
   if (current->uid == uid)
     {
       if (dumped)
@@ -608,11 +611,10 @@ read_proc (void)
             {
               memset(comm, '\0', COMM_LEN+1);
               tmpptr = strrchr(readbuf, ')'); /* find last ) */
-              *tmpptr = '\0';
               /* We now have readbuf with pid and cmd, and tmpptr+2
                * with the rest */
               /*printf("readbuf: %s\n", readbuf);*/
-              if (sscanf(readbuf, "%*d (%15c", comm) == 1)
+              if (sscanf(readbuf, "%*d (%15[^)]", comm) == 1)
               {
                 /*printf("tmpptr: %s\n", tmpptr+2);*/
                 if (sscanf(tmpptr+2, "%*c %d", &ppid) == 1)