Author: archaic Date: 2005-05-08 21:57:56 -0600 (Sun, 08 May 2005) New Revision: 946
Added: trunk/hlfs/psmisc-21.6-scanf-1.patch trunk/psmisc/psmisc-21.6-scanf-1.patch Log: Added: psmisc-21.6-scanf-1.patch (HLFS) Added: trunk/hlfs/psmisc-21.6-scanf-1.patch =================================================================== --- trunk/hlfs/psmisc-21.6-scanf-1.patch 2005-05-09 03:55:15 UTC (rev 945) +++ trunk/hlfs/psmisc-21.6-scanf-1.patch 2005-05-09 03:57:56 UTC (rev 946) @@ -0,0 +1,54 @@ +Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes) +Date: 2005-04-29 +Initial Package Version: 21.6 +Upstream Status: Submitted +ORIGIN: http://www.gentoo.org/cgi-bin/viewcvs.cgi/sys-process/psmisc/files/\ + psmisc-21.6-scanf.patch +Description: This fixes pstree. + +Fix sscanf() invocation to be C98/C99 compliant. Most people don't +notice because glibc isn't C98/C99 compliant in this respect, but +some of us use libc's which are :). + +to be more specific, mjn3 of uClibc writes: +Both C99 and C89 state that the %c conversion for scanf reads the +exact number of bytes specified by the optional field width (or 1 +if not specified). There is an argument that perhaps the specified +width should be treated as an upper bound, based on some historical +use. Glibc does not obey this specification nor mention it in any +compliance documentation. + +Also, the first hunk is to fix segfaults that may arise from +running pstree with an user argument but find_proc(1) is NULL. +This normally doesn't occur, but it is possible: [EMAIL PROTECTED] 0 src $ pstree vapier +Segmentation fault + +Mike Frysinger <[EMAIL PROTECTED]> + +diff -Naur psmisc-21.6.orig/src/pstree.c psmisc-21.6/src/pstree.c +--- psmisc-21.6.orig/src/pstree.c 2004-12-15 11:15:52.000000000 +0000 ++++ psmisc-21.6/src/pstree.c 2005-04-30 00:41:05.000000000 +0000 +@@ -544,6 +544,9 @@ + { + const CHILD *walk; + ++ if (!current) ++ return; ++ + if (current->uid == uid) + { + if (dumped) +@@ -616,11 +619,10 @@ + { + 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 (%[^)]", comm) == 1) + { + /*printf("tmpptr: %s\n", tmpptr+2);*/ + if (sscanf(tmpptr+2, "%*c %d", &ppid) == 1) Added: trunk/psmisc/psmisc-21.6-scanf-1.patch =================================================================== --- trunk/psmisc/psmisc-21.6-scanf-1.patch 2005-05-09 03:55:15 UTC (rev 945) +++ trunk/psmisc/psmisc-21.6-scanf-1.patch 2005-05-09 03:57:56 UTC (rev 946) @@ -0,0 +1 @@ +link ../hlfs/psmisc-21.6-scanf-1.patch \ No newline at end of file Property changes on: trunk/psmisc/psmisc-21.6-scanf-1.patch ___________________________________________________________________ Name: svn:special + * -- http://linuxfromscratch.org/mailman/listinfo/patches FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
