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

Commit 9028fb4d authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Pass the correct pointer to munmap on failure."

parents 27f31606 c86f22c1
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -95,16 +95,16 @@ int sysLoadFileInShmem(int fd, MemMapping* pMap)
    if (memPtr == NULL)
    if (memPtr == NULL)
        return -1;
        return -1;


    actual = read(fd, memPtr, length);
    pMap->baseAddr = pMap->addr = memPtr;
    pMap->baseLength = pMap->length = length;

    actual = TEMP_FAILURE_RETRY(read(fd, memPtr, length));
    if (actual != length) {
    if (actual != length) {
        LOGE("only read %d of %d bytes\n", (int) actual, (int) length);
        LOGE("only read %d of %d bytes\n", (int) actual, (int) length);
        sysReleaseShmem(pMap);
        sysReleaseShmem(pMap);
        return -1;
        return -1;
    }
    }


    pMap->baseAddr = pMap->addr = memPtr;
    pMap->baseLength = pMap->length = length;

    return 0;
    return 0;
}
}