Skip to content
Commit ae32f7e5 authored by qiwang's avatar qiwang Committed by Chris Wailes
Browse files

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: default avatarqiwang <wangqi_a@xiaomi.com>
parent 156f347d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment