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

Commit 3e29e4a3 authored by Josh Gao's avatar Josh Gao
Browse files

Fix file descriptor ownership.

Previously, we attempt to pass ownership of the fd owned by a
ParcelFileDescriptor to a FileInputStream, which explodes when we try to
close it.

Bug: http://b/156867945
Test: treehugger
Change-Id: I9d5124658beb50f0a08499ed09e652037cb9ae66
parent 0b2bb19d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
package com.android.server.backup.restore;

import android.os.ParcelFileDescriptor;
import android.os.ParcelFileDescriptor.AutoCloseInputStream;

import libcore.io.IoUtils;

import java.io.FileInputStream;
import java.io.InputStream;

class FullRestoreEngineThread implements Runnable {
@@ -19,7 +19,7 @@ class FullRestoreEngineThread implements Runnable {
        // We *do* want this FileInputStream to own the underlying fd, so that
        // when we are finished with it, it closes this end of the pipe in a way
        // that signals its other end.
        mEngineStream = new FileInputStream(engineSocket.getFileDescriptor(), true);
        mEngineStream = new AutoCloseInputStream(engineSocket);
        // Tell it to be sure to leave the agent instance up after finishing
        mMustKillAgent = false;
    }