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

Commit 2e451c81 authored by Ramanan Rajeswaran's avatar Ramanan Rajeswaran Committed by Android (Google) Code Review
Browse files

Merge "Fix crash in TranserPipe." into lmp-dev

parents 5fcdcee0 5ec679a0
Loading
Loading
Loading
Loading
+16 −4
Original line number Diff line number Diff line
@@ -174,15 +174,27 @@ public final class TransferPipe implements Runnable {
    }

    public void kill() {
        synchronized (this) {
            closeFd(0);
            closeFd(1);
        }
    }

    @Override
    public void run() {
        final byte[] buffer = new byte[1024];
        final FileInputStream fis = new FileInputStream(getReadFd().getFileDescriptor());
        final FileOutputStream fos = new FileOutputStream(mOutFd);
        final FileInputStream fis;
        final FileOutputStream fos;

        synchronized (this) {
            ParcelFileDescriptor readFd = getReadFd();
            if (readFd == null) {
                Slog.w(TAG, "Pipe has been closed...");
                return;
            }
            fis = new FileInputStream(readFd.getFileDescriptor());
            fos = new FileOutputStream(mOutFd);
        }

        if (DEBUG) Slog.i(TAG, "Ready to read pipe...");
        byte[] bufferPrefix = null;