| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 2  * Copyright (c) 2014 The Native Client Authors. All rights reserved. | 
| 3  * Use of this source code is governed by a BSD-style license that can be | 3  * Use of this source code is governed by a BSD-style license that can be | 
| 4  * found in the LICENSE file. | 4  * found in the LICENSE file. | 
| 5  */ | 5  */ | 
| 6 | 6 | 
| 7 #include "native_client/src/trusted/service_runtime/sel_main_common.h" | 7 #include "native_client/src/trusted/service_runtime/sel_main_common.h" | 
| 8 | 8 | 
| 9 #include "native_client/src/include/build_config.h" | 9 #include "native_client/src/include/build_config.h" | 
| 10 | 10 | 
| 11 #if NACL_OSX | 11 #if NACL_OSX | 
| 12 #include <crt_externs.h> | 12 #include <crt_externs.h> | 
| 13 #endif | 13 #endif | 
| 14 | 14 | 
| 15 #include "native_client/src/shared/platform/nacl_check.h" | 15 #include "native_client/src/shared/platform/nacl_check.h" | 
|  | 16 #include "native_client/src/trusted/desc/nacl_desc_base.h" | 
| 16 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 17 #include "native_client/src/trusted/service_runtime/sel_ldr.h" | 
| 17 | 18 | 
| 18 NaClErrorCode NaClMainLoadIrt(struct NaClApp *nap, struct NaClDesc *nd, | 19 NaClErrorCode NaClMainLoadIrt(struct NaClApp *nap, struct NaClDesc *nd, | 
| 19                               struct NaClValidationMetadata *metadata) { | 20                               struct NaClValidationMetadata *metadata) { | 
| 20   NaClErrorCode errcode; | 21   NaClErrorCode errcode; | 
| 21   errcode = NaClAppLoadFileDynamically(nap, nd, metadata); | 22   errcode = NaClAppLoadFileDynamically(nap, nd, metadata); | 
| 22   if (errcode != LOAD_OK) { | 23   if (errcode != LOAD_OK) { | 
| 23     return errcode; | 24     return errcode; | 
| 24   } | 25   } | 
| 25   CHECK(NULL == nap->irt_nexe_desc); | 26   CHECK(NULL == nap->irt_nexe_desc); | 
| 26   NaClDescRef(nd); | 27   NaClDescRef(nd); | 
| 27   nap->irt_nexe_desc = nd; | 28   nap->irt_nexe_desc = nd; | 
| 28   return LOAD_OK; | 29   return LOAD_OK; | 
| 29 } | 30 } | 
| 30 | 31 | 
| 31 const char ** NaClGetEnviron(void) { | 32 const char ** NaClGetEnviron(void) { | 
| 32   const char **envp; | 33   const char **envp; | 
| 33 #if NACL_OSX | 34 #if NACL_OSX | 
| 34   /* Mac dynamic libraries cannot access the environ variable directly. */ | 35   /* Mac dynamic libraries cannot access the environ variable directly. */ | 
| 35   envp = (const char **) *_NSGetEnviron(); | 36   envp = (const char **) *_NSGetEnviron(); | 
| 36 #else | 37 #else | 
| 37   /* Overzealous code style check is overzealous. */ | 38   /* Overzealous code style check is overzealous. */ | 
| 38   /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ | 39   /* @IGNORE_LINES_FOR_CODE_HYGIENE[1] */ | 
| 39   extern char **environ; | 40   extern char **environ; | 
| 40   envp = (const char **) environ; | 41   envp = (const char **) environ; | 
| 41 #endif | 42 #endif | 
| 42   return envp; | 43   return envp; | 
| 43 } | 44 } | 
| OLD | NEW | 
|---|