Add mode when open(O_CREAT) is used.
When creating a new file using open(..., O_CREAT), it is an error
to fail to specify a creation mode. If a mode is not specified, a
random stack provided value is used as the "mode".
This will become a compile error in a future Android change.
Change-Id: I36a3d67d294a915c1f79632a1b0ba45edd1214b1
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index 5606187..662a93d 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -931,7 +931,7 @@
initialData = ret - MTP_CONTAINER_HEADER_SIZE;
mtp_file_range mfr;
- mfr.fd = open(mSendObjectFilePath, O_RDWR | O_CREAT | O_TRUNC);
+ mfr.fd = open(mSendObjectFilePath, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (mfr.fd < 0) {
result = MTP_RESPONSE_GENERAL_ERROR;
goto done;