summaryrefslogtreecommitdiffstats
path: root/mtp
diff options
context:
space:
mode:
Diffstat (limited to 'mtp')
-rw-r--r--mtp/ffs/MtpDevHandle.cpp5
-rw-r--r--mtp/ffs/MtpDevHandle.h2
-rwxr-xr-xmtp/ffs/MtpServer.cpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/mtp/ffs/MtpDevHandle.cpp b/mtp/ffs/MtpDevHandle.cpp
index d6a8b820d..e22ba55b2 100644
--- a/mtp/ffs/MtpDevHandle.cpp
+++ b/mtp/ffs/MtpDevHandle.cpp
@@ -33,8 +33,9 @@
constexpr char mtp_dev_path[] = "/dev/mtp_usb";
-MtpDevHandle::MtpDevHandle()
- : mFd(-1) {};
+MtpDevHandle::MtpDevHandle(int controlFd) {
+ mFd.reset(controlFd);
+}
MtpDevHandle::~MtpDevHandle() {}
diff --git a/mtp/ffs/MtpDevHandle.h b/mtp/ffs/MtpDevHandle.h
index 4b0692889..4ea1fdb2e 100644
--- a/mtp/ffs/MtpDevHandle.h
+++ b/mtp/ffs/MtpDevHandle.h
@@ -25,7 +25,7 @@ private:
android::base::unique_fd mFd;
public:
- MtpDevHandle();
+ MtpDevHandle(int controlFd);
~MtpDevHandle();
int read(void *data, size_t len);
int write(const void *data, size_t len);
diff --git a/mtp/ffs/MtpServer.cpp b/mtp/ffs/MtpServer.cpp
index 5f17ff2ff..fa6702433 100755
--- a/mtp/ffs/MtpServer.cpp
+++ b/mtp/ffs/MtpServer.cpp
@@ -123,7 +123,7 @@ MtpServer::MtpServer(IMtpDatabase* database, int controlFd, bool ptp,
mHandle = aio_compat ? new MtpFfsCompatHandle(controlFd) : new MtpFfsHandle(controlFd);
mHandle->writeDescriptors(mPtp);
} else {
- mHandle = new MtpDevHandle();
+ mHandle = new MtpDevHandle(controlFd);
}
}