third_party/webports/src/src/ports/nacl-spawn/nacl_spawn.cc
static bool IsPNaClType(const std::string& filename) {
  // Open script.
  int fh = open(filename.c_str(), O_RDONLY);
  if (fh < 0) {
    // Default to nacl type if the file can't be read.
    return false;
  }
  // Read first 4 bytes.
  char buffer[4];
  ssize_t len = read(fh, buffer, sizeof buffer);
  close(fh);
  // Decide based on the header.
  return len == 4 && memcmp(buffer, "PEXE", sizeof buffer) == 0;
}
// Check if a file is a pnacl type file.
// If the file can't be read, return false.
Check if a file is a pnacl type file.
If the file can't be read, return false.
Check if a file is a pnacl type file . If the file can ' t be read return false .
static bool IsPNaClType(const std::string& filename) {
  int fh = open(filename.c_str(), O_RDONLY);
  if (fh < 0) {
    return false;
  }
  char buffer[4];
  ssize_t len = read(fh, buffer, sizeof buffer);
  close(fh);
  return len == 4 && memcmp(buffer, "PEXE", sizeof buffer) == 0;
}
static bool IsPNaClType ( const std :: string & filename ) { int fh = open ( filename . c_str ( ) , O_RDONLY ) ; if ( fh < 0 ) { return false ; } char buffer [ 4 ] ; ssize_t len = read ( fh , buffer , sizeof buffer ) ; close ( fh ) ; return len == 4 && memcmp ( buffer , " " , sizeof buffer ) == 0 ; }
Check if a file is a pnacl type file.
Check if a file is a pnacl type file .
// Open script. // Default to nacl type if the file can't be read. // Read first 4 bytes. // Decide based on the header.