<commit_before>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/nacl_security_tests/commands_posix.h"

#include <fcntl.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

#include <string>

// Sandbox access tests (mimic'ing "sandbox/tests/validation_tests/commands.h")

namespace sandbox {

SboxTestResult TestOpenReadFile(const char *path) {
  int fd = open(path, O_RDONLY | O_CREAT);
  if (-1 == fd) {
    return SBOX_TEST_DENIED;
  } else {
    close(fd);
    return SBOX_TEST_SUCCEEDED;
  }
}

SboxTestResult TestOpenWriteFile(const char *path) {
  int fd = open(path, O_WRONLY | O_CREAT);
  if (-1 == fd) {
    return SBOX_TEST_DENIED;
  } else {
    close(fd);<commit_msg>Fix a compile error in nacl_security_tests on some versions of gcc.<commit_after>// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/nacl_security_tests/commands_posix.h"

#include <fcntl.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

#include <string>

// Sandbox access tests (mimic'ing "sandbox/tests/validation_tests/commands.h")

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, kCreatePermissions);
  if (-1 == fd) {
    return SBOX_TEST_DENIED;
  } else {
    close(fd);
    return SBOX_TEST_SUCCEEDED;
  }
}

SboxTestResult TestOpenWriteFile(const char *path) {
  int fd = open(path, O_WRONLY | O_CREAT, kCreatePermissions);
  if (-1 == fd) {
    return SBOX_TEST_DENIED;
  } else {
    close(fd);
{'fraction_non_alphanumeric': 0.12101910828025478, 'fraction_numerical': 0.007839294463498285, 'mean_word_length': 4.079601990049751, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7242687', 'n_tokens_mistral': 761, 'n_tokens_neox': 737, 'n_words': 206}