diff options
author | Nick Kralevich <nnk@google.com> | 2012-06-26 15:03:38 -0700 |
---|---|---|
committer | Nick Kralevich <nnk@google.com> | 2012-06-26 15:03:38 -0700 |
commit | 4b447b91debda9c9a0e230cab9e140e356b2a305 (patch) | |
tree | df6f200b93e6bbc5345d439a00e6d9a22fc9e406 /libs/androidfw | |
parent | 0cedfe09e5083a274a8c449ca52f735a177e1817 (diff) | |
download | frameworks_base-4b447b91debda9c9a0e230cab9e140e356b2a305.zip frameworks_base-4b447b91debda9c9a0e230cab9e140e356b2a305.tar.gz frameworks_base-4b447b91debda9c9a0e230cab9e140e356b2a305.tar.bz2 |
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: I8635e8b69587ed107253870d991c3fcf563ca876
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/tests/ObbFile_test.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/androidfw/tests/ObbFile_test.cpp b/libs/androidfw/tests/ObbFile_test.cpp index 09d4d7d..2c9f650 100644 --- a/libs/androidfw/tests/ObbFile_test.cpp +++ b/libs/androidfw/tests/ObbFile_test.cpp @@ -22,6 +22,8 @@ #include <gtest/gtest.h> +#include <sys/types.h> +#include <sys/stat.h> #include <fcntl.h> #include <string.h> @@ -43,7 +45,7 @@ protected: mFileName = new char[totalLen]; snprintf(mFileName, totalLen, "%s%s", mExternalStorage, TEST_FILENAME); - int fd = ::open(mFileName, O_CREAT | O_TRUNC); + int fd = ::open(mFileName, O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); if (fd < 0) { FAIL() << "Couldn't create " << mFileName << " for tests"; } |