static struct NaClDesc *NaClResourceNaClAppFileOpen( struct NaClResource *vself, char const *resource_locator, int nacl_flags, int mode, int allow_debug) { struct NaClResourceNaClApp *self = (struct NaClResourceNaClApp *) vself; struct NaClDesc *rv = NULL; /* * Initialization order requires that file opens occur only early, * in NACl_RESOURCE_PHASE_START, because otherwise (in the OSX case) * the sandbox gets enabled after the reverse channel is set up, and * the ability to open files go away. */ UNREFERENCED_PARAMETER(allow_debug); if (self->nap->resource_phase != NACL_RESOURCE_PHASE_START) { return NULL; } if (0 == strcmp(resource_locator, NACL_RESOURCE_FILE_DEV_NULL)) { rv = NaClResourceNullFactory(); if (NULL == rv) { NaClLog(LOG_ERROR, "Could not create Null device. Redirect failed.\n"); } } else { rv = NaClResourceFileFactory(resource_locator, nacl_flags, mode); if (NULL == rv) { NaClLog(LOG_ERROR, "Could not open file \"%s\". Redirect failed.\n", resource_locator); } } NaClLog(4, "NaClResourceNaClAppFileOpen returning 0x%"NACL_PRIxPTR"\n", (uintptr_t) rv); return rv; }
static struct NaClDesc *NaClResourceNaClAppFileOpen( struct NaClResource *vself, char const *resource_locator, int nacl_flags, int mode, int allow_debug) { struct NaClDesc *rv = NULL; UNREFERENCED_PARAMETER(vself); UNREFERENCED_PARAMETER(allow_debug); if (0 == strcmp(resource_locator, NACL_RESOURCE_FILE_DEV_NULL)) { rv = NaClResourceNullFactory(); if (NULL == rv) { NaClLog(LOG_ERROR, "Could not create Null device. Redirect failed.\n"); } } else { rv = NaClResourceFileFactory(resource_locator, nacl_flags, mode); if (NULL == rv) { NaClLog(LOG_ERROR, "Could not open file \"%s\". Redirect failed.\n", resource_locator); } } NaClLog(4, "NaClResourceNaClAppFileOpen returning 0x%"NACL_PRIxPTR"\n", (uintptr_t) rv); return rv; }