From f5121bcba8cf12f2e61b3f0385ccf0851b3efe99 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Fri, 16 Jul 2010 22:32:38 +0000 Subject: Fix a compile error in nacl_security_tests on some versions of gcc. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some versions of gcc give the following compilation error: /usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments make: *** [out/Release/obj.target/nacl_security_tests/chrome/test/nacl_security_tests/commands_posix.o] Error 1 So provide a third argument (the permissions of the file if created). Review URL: http://codereview.chromium.org/3046001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52765 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/nacl_security_tests/commands_posix.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/test/nacl_security_tests/commands_posix.cc b/chrome/test/nacl_security_tests/commands_posix.cc index 013043e..79bcde7 100644 --- a/chrome/test/nacl_security_tests/commands_posix.cc +++ b/chrome/test/nacl_security_tests/commands_posix.cc @@ -19,8 +19,11 @@ namespace sandbox { +// Permissions for the user to read & write and others to read. +const mode_t kCreatePermissions = 0644; + SboxTestResult TestOpenReadFile(const char *path) { - int fd = open(path, O_RDONLY | O_CREAT); + int fd = open(path, O_RDONLY | O_CREAT, kCreatePermissions); if (-1 == fd) { return SBOX_TEST_DENIED; } else { @@ -30,7 +33,7 @@ SboxTestResult TestOpenReadFile(const char *path) { } SboxTestResult TestOpenWriteFile(const char *path) { - int fd = open(path, O_WRONLY | O_CREAT); + int fd = open(path, O_WRONLY | O_CREAT, kCreatePermissions); if (-1 == fd) { return SBOX_TEST_DENIED; } else { -- cgit v1.1