summaryrefslogtreecommitdiff
path: root/libs/services
diff options
context:
space:
mode:
authorPrimiano Tucci <primiano@google.com>2018-01-30 18:55:57 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-01-30 18:55:57 +0000
commit4307efc89eccc773a50036e83ccec734b23bdb95 (patch)
treeda85c13268bff0f1d3c3492a963f1ef08d98fe15 /libs/services
parentd32110ed327477722f0b49f154bea6d0db596ab0 (diff)
parent72b12e4222895d2b6a1d01ccaa628ce6ae4c0fca (diff)
Merge "DropboxManager: Add err message if passing an invalid fd to addFile()" am: 90529d212a am: 13d6ac4a35
am: 72b12e4222 Change-Id: Icfe984f46cb6e6cdc216d7182285c7e55abe93ab
Diffstat (limited to 'libs/services')
-rw-r--r--libs/services/src/os/DropBoxManager.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/services/src/os/DropBoxManager.cpp b/libs/services/src/os/DropBoxManager.cpp
index f5685d9ca753..c2907a66fb99 100644
--- a/libs/services/src/os/DropBoxManager.cpp
+++ b/libs/services/src/os/DropBoxManager.cpp
@@ -208,6 +208,11 @@ DropBoxManager::addFile(const String16& tag, const string& filename, int flags)
Status
DropBoxManager::addFile(const String16& tag, int fd, int flags)
{
+ if (fd == -1) {
+ string message("invalid fd (-1) passed to to addFile");
+ ALOGW("DropboxManager: %s", message.c_str());
+ return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE, message.c_str());
+ }
Entry entry(tag, flags, fd);
return add(entry);
}
@@ -235,4 +240,3 @@ DropBoxManager::getNextEntry(const String16& tag, long msec, Entry* entry)
}
}} // namespace android::os
-