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

Commit 49458e05 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan Committed by android-build-merger
Browse files

Merge "lmkd: Fix killed process name reporting"

am: 7c2f94bd

Change-Id: I82d986b3ef6f19878df8b536ac047d01c0be2ce0
parents cb01c853 7c2f94bd
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1321,8 +1321,9 @@ static char *proc_get_name(int pid) {
    /* gid containing AID_READPROC required */
    snprintf(path, PATH_MAX, "/proc/%d/cmdline", pid);
    fd = open(path, O_RDONLY | O_CLOEXEC);
    if (fd == -1)
    if (fd == -1) {
        return NULL;
    }
    ret = read_all(fd, line, sizeof(line) - 1);
    close(fd);
    if (ret < 0) {
@@ -1330,8 +1331,11 @@ static char *proc_get_name(int pid) {
    }

    cp = strchr(line, ' ');
    if (cp)
    if (cp) {
        *cp = '\0';
    } else {
        line[ret] = '\0';
    }

    return line;
}