summaryrefslogtreecommitdiffstats
path: root/mtp/MtpServer.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2015-01-30 17:08:48 +0100
committerDees Troy <dees_troy@teamw.in>2015-02-02 15:45:51 +0100
commit1b03920ca7d576c8400dd006ac1bbdecc1664231 (patch)
treef00558bafaa42a3bcd212ac1ac98b4b4c51f600b /mtp/MtpServer.cpp
parentgui: simplify code in GUIKeyboard (diff)
downloadandroid_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar.gz
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar.bz2
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar.lz
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar.xz
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.tar.zst
android_bootable_recovery-1b03920ca7d576c8400dd006ac1bbdecc1664231.zip
Diffstat (limited to '')
-rwxr-xr-xmtp/MtpServer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/mtp/MtpServer.cpp b/mtp/MtpServer.cpp
index 2c6d37648..9cd67324f 100755
--- a/mtp/MtpServer.cpp
+++ b/mtp/MtpServer.cpp
@@ -96,10 +96,9 @@ static const MtpEventCode kSupportedEventCodes[] = {
MTP_EVENT_OBJECT_PROP_CHANGED,
};
-MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp,
+MtpServer::MtpServer(MtpDatabase* database, bool ptp,
int fileGroup, int filePerm, int directoryPerm)
- : mFD(fd),
- mDatabase(database),
+ : mDatabase(database),
mPtp(ptp),
mFileGroup(fileGroup),
mFilePermission(filePerm),
@@ -110,6 +109,7 @@ MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp,
mSendObjectFormat(0),
mSendObjectFileSize(0)
{
+ mFD = -1;
}
MtpServer::~MtpServer() {
@@ -183,9 +183,11 @@ bool MtpServer::hasStorage(MtpStorageID id) {
return (getStorage(id) != NULL);
}
-void MtpServer::run() {
- int fd = mFD;
+void MtpServer::run(int fd) {
+ if (fd < 0)
+ return;
+ mFD = fd;
MTPI("MtpServer::run fd: %d\n", fd);
while (1) {
@@ -275,7 +277,7 @@ void MtpServer::run() {
mObjectEditList.clear();
if (mSessionOpen)
- mDatabase->sessionEnded();
+ mDatabase->sessionEnded(); // This doesn't actually do anything but was carry over from AOSP
close(fd);
mFD = -1;
}