OSDN Git Service

Fix the pidof comm and cmdline tests.
authorElliott Hughes <enh@google.com>
Fri, 9 Feb 2018 06:41:52 +0000 (22:41 -0800)
committerRob Landley <rob@landley.net>
Fri, 9 Feb 2018 19:06:58 +0000 (13:06 -0600)
commit2530d54f1145a7bf6b634f630344ed42adf388e5
treeb93d3f6b30f74ec08ddc93de23f41b1e4bc63538
parent912646fc08d1b5e497f5ddb9b14e994f6b44e291
Fix the pidof comm and cmdline tests.

If we have a 15-byte name, we don't know whether comm actually matches
or is a truncated form of a longer name that has a common prefix.

For example, with "this-is-a-very-long-name-that-is-too-long", we shouldn't
match "this-is-a-very-" (but the old code would).

The cmdline code was also broken on Android because it used basename(3)
rather than getbasename. This doesn't affect glibc because there's a
workaround in portability.h to ensure that we get the non-POSIX basename(3)
with glibc but then a non-glibc section that ensures everyone else gets
POSIX basename(3). That should probably be removed (and maybe `basename`
poisoned) to prevent similar mistakes in future.

Bug: http://b/73123244
lib/lib.c