aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2017-07-31 13:55:52 -0700
committerGeorge Burgess IV <gbiv@google.com>2017-07-31 14:03:15 -0700
commit0bba2e896d09c7ef7b49a409ba5cd869531befa9 (patch)
tree58dd509e7da91b8131cb012b895be4e08ed09e35
parentc33d1f8c4b98fa6aa24c67d484d31b58c0651933 (diff)
downloadplatform_external_linux-kselftest-o-iot-preview-5.tar.gz
platform_external_linux-kselftest-o-iot-preview-5.tar.bz2
platform_external_linux-kselftest-o-iot-preview-5.zip
Open modes are ignored if the user doesn't want the file to be created: http://man7.org/linux/man-pages/man2/open.2.html Since it's somewhat misleading/potentially indicative of a missing O_CREAT/O_TMPFILE, we plan to issue a warning on open calls with useless mode bits in the near future. Because -Werror is used in this project (thank you!), we need to either make the mode useful, or remove it. Bug: 64132680 Test: mma. New warning no longer appears. Change-Id: I6d9e59355a0071bc2989f54a3b921a36b90d1857
-rw-r--r--android/patches/0004-Remove-useless-open-mode.patch20
-rw-r--r--tools/testing/selftests/kcmp/kcmp_test.c2
2 files changed, 21 insertions, 1 deletions
diff --git a/android/patches/0004-Remove-useless-open-mode.patch b/android/patches/0004-Remove-useless-open-mode.patch
new file mode 100644
index 000000000000..c79ed5f674f0
--- /dev/null
+++ b/android/patches/0004-Remove-useless-open-mode.patch
@@ -0,0 +1,20 @@
+Open modes are ignored if the user doesn't want the file to be created:
+http://man7.org/linux/man-pages/man2/open.2.html
+
+We're going to start emitting compile-time warnings about this soon.
+Since this project has -Werror enabled (thank you!), we need to either
+make the mode useful or remove the mode bits.
+
+diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
+index a5a4da856dfe..ef7927e5940f 100644
+--- a/tools/testing/selftests/kcmp/kcmp_test.c
++++ b/tools/testing/selftests/kcmp/kcmp_test.c
+@@ -49,7 +49,7 @@ int main(int argc, char **argv)
+ int pid2 = getpid();
+ int ret;
+
+- fd2 = open(kpath, O_RDWR, 0644);
++ fd2 = open(kpath, O_RDWR);
+ if (fd2 < 0) {
+ perror("Can't open file");
+ ksft_exit_fail();
diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
index a5a4da856dfe..ef7927e5940f 100644
--- a/tools/testing/selftests/kcmp/kcmp_test.c
+++ b/tools/testing/selftests/kcmp/kcmp_test.c
@@ -49,7 +49,7 @@ int main(int argc, char **argv)
int pid2 = getpid();
int ret;
- fd2 = open(kpath, O_RDWR, 0644);
+ fd2 = open(kpath, O_RDWR);
if (fd2 < 0) {
perror("Can't open file");
ksft_exit_fail();