Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d652176 authored by Tim Murray's avatar Tim Murray
Browse files

fix getRss crash

getRss was not correctly handling the case when a process had died.

Test: boots, works
Bug: 119988524
Change-Id: I86f5d586b2b665d68b09a2f587941aeb7def1c9d
parent b5555f69
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1137,7 +1137,7 @@ static jlongArray android_os_Process_getRss(JNIEnv* env, jobject clazz, jint pid
    UniqueFile file = MakeUniqueFile(status_path.c_str(), "re");

    char line[256];
    while (fgets(line, sizeof(line), file.get())) {
    while (file != nullptr && fgets(line, sizeof(line), file.get())) {
        jlong v;
        if ( sscanf(line, "VmRSS: %" SCNd64 " kB", &v) == 1) {
            rss[0] = v;