user_collector: use %P instead of %p

The latter will give us the PID as seen in the current PID namespace,
but since the crash handler always runs in the top most PID namespace,
that is meaningless to us.  Instead, use the %P option so we see the
PID in the top most namespace.

BUG=chromium:351568
TEST=`cbuildbot amd64-generic-full` passes # linux-3.10
TEST=`cbuildbot x86-alex-release` passes   # linux-3.4
TEST=`cbuildbot link-release` passes       # linux-3.8
CQ-DEPEND=CL:190011
CQ-DEPEND=CL:190020
CQ-DEPEND=CL:190012
CQ-DEPEND=CL:190021

Change-Id: Ic619c4e7514e2824f7ba31b73cb9e11ec4092774
Reviewed-on: https://chromium-review.googlesource.com/190010
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/crash_reporter/user_collector.cc b/crash_reporter/user_collector.cc
index 4afad43..f6841e6 100644
--- a/crash_reporter/user_collector.cc
+++ b/crash_reporter/user_collector.cc
@@ -107,7 +107,7 @@
     // the size of the invocation line for crash_reporter, since the kernel
     // has a fixed-sized (128B) buffer for it (before parameter expansion).
     // Note that the kernel does not support quoted arguments in core_pattern.
-    return StringPrintf("|%s --user=%%p:%%s:%%u:%%e", our_path_.c_str());
+    return StringPrintf("|%s --user=%%P:%%s:%%u:%%e", our_path_.c_str());
   } else {
     return "core";
   }
diff --git a/crash_reporter/user_collector_test.cc b/crash_reporter/user_collector_test.cc
index d416a7b..eed6daf 100644
--- a/crash_reporter/user_collector_test.cc
+++ b/crash_reporter/user_collector_test.cc
@@ -71,7 +71,7 @@
 
 TEST_F(UserCollectorTest, EnableOK) {
   ASSERT_TRUE(collector_.Enable());
-  ExpectFileEquals("|/my/path --user=%p:%s:%u:%e", "test/core_pattern");
+  ExpectFileEquals("|/my/path --user=%P:%s:%u:%e", "test/core_pattern");
   ExpectFileEquals("4", "test/core_pipe_limit");
   ASSERT_EQ(s_crashes, 0);
   EXPECT_TRUE(FindLog("Enabling user crash handling"));