Don't clear the output array if it failed to open the proc status file
According to the original documentation, the functions in Process.java
should return -1 when the process doesn't exist,this should be detected
by Process.readProcLine() when it fails to open the /proc/<pid>/status
file. Unfortunately readProcLine() zeroes-out the output array before
attempting to open the file, so the expected return value -1 is changed
to be 0 when the process doesn't exist. It's inconsistent with the
interface description definition, so correct it.
Test: try to use Process.getUidForPid(int pid) api to read a non-existent
process pid's uid, it will return -1 instead of 0.
Merged-In: Ic2ac7defea8b15dd65f907d04e168a1283a4f621
Change-Id: Ic2ac7defea8b15dd65f907d04e168a1283a4f621
Signed-off-by: qiwang <wangqi_a@xiaomi.com>
2 files changed