summaryrefslogtreecommitdiffstats
path: root/mtp/mtp_MtpServer.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-12-29 16:15:37 +0100
committerDees Troy <dees_troy@teamw.in>2014-12-29 16:25:32 +0100
commit4bfabab005bac62373b80407136b75509b8b57db (patch)
tree131dadbfff9de6fad82dbdc351d2531ca1cce355 /mtp/mtp_MtpServer.cpp
parentIngore SIGPIPE errors (diff)
downloadandroid_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar.gz
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar.bz2
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar.lz
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar.xz
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.tar.zst
android_bootable_recovery-4bfabab005bac62373b80407136b75509b8b57db.zip
Diffstat (limited to 'mtp/mtp_MtpServer.cpp')
-rwxr-xr-xmtp/mtp_MtpServer.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/mtp/mtp_MtpServer.cpp b/mtp/mtp_MtpServer.cpp
index 5f509eb0d..96a1e9453 100755
--- a/mtp/mtp_MtpServer.cpp
+++ b/mtp/mtp_MtpServer.cpp
@@ -170,11 +170,15 @@ int twmtp_MtpServer::mtppipe_thread(void)
if (read_count == sizeof(mtp_message)) {
if (mtp_message.message_type == MTP_MESSAGE_ADD_STORAGE) {
MTPI("mtppipe add storage %i '%s'\n", mtp_message.storage_id, mtp_message.path);
- long reserveSpace = 1;
- bool removable = false;
- MtpStorage* storage = new MtpStorage(mtp_message.storage_id, mtp_message.path, mtp_message.display, reserveSpace, removable, mtp_message.maxFileSize, refserver);
- server->addStorage(storage);
- MTPD("mtppipe done adding storage\n");
+ if (mtp_message.storage_id) {
+ long reserveSpace = 1;
+ bool removable = false;
+ MtpStorage* storage = new MtpStorage(mtp_message.storage_id, mtp_message.path, mtp_message.display, reserveSpace, removable, mtp_message.maxFileSize, refserver);
+ server->addStorage(storage);
+ MTPD("mtppipe done adding storage\n");
+ } else {
+ MTPE("Invalid storage ID %i specified\n", mtp_message.storage_id);
+ }
} else if (mtp_message.message_type == MTP_MESSAGE_REMOVE_STORAGE) {
MTPI("mtppipe remove storage %i\n", mtp_message.storage_id);
remove_storage(mtp_message.storage_id);