diff --git a/rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c b/rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c index c09aee713b8a48a3ef2b1634b5d3a47b7bc05395..e7c25e9e4a133dff1a1c8c2b09d171efb84bbbd3 100644 --- a/rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c +++ b/rune/libenclave/internal/runtime/pal/skeleton/liberpal-skeleton.c @@ -145,7 +145,7 @@ out_dev_fd: return false; } -bool get_file_size(const char *path, off_t *bin_size) +static bool get_file_size(const char *path, off_t *bin_size) { struct stat sb; int ret; @@ -165,7 +165,7 @@ bool get_file_size(const char *path, off_t *bin_size) return true; } -bool encl_data_map(const char *path, void **bin, off_t *bin_size) +static bool encl_data_map(const char *path, void **bin, off_t *bin_size) { int fd; @@ -192,7 +192,7 @@ err_out: return false; } -bool load_sigstruct(const char *path, void *sigstruct) +static bool load_sigstruct(const char *path, void *sigstruct) { int fd; @@ -213,7 +213,7 @@ bool load_sigstruct(const char *path, void *sigstruct) return true; } -bool load_token(const char *path, void *token) +static bool load_token(const char *path, void *token) { int fd; @@ -259,15 +259,22 @@ int pal_init(const char *args, const char *log_level) return -EINVAL; initialized = true; + return 0; } int pal_exec(char *path, char *argv[], const char *envp[], int *exit_code, int stdin, int stdout, int stderr) { - FILE *fp = fdopen(stderr, "w"); - if (!fp) - return -1; + FILE *fp = fdopen(stderr, "w"); + if (!fp) + return -1; + + if (!initialized) { + fprintf(fp, "enclave runtime skeleton uninitialized yet!\n"); + fclose(fp); + return -1; + } uint64_t result = 0; @@ -280,7 +287,9 @@ int pal_exec(char *path, char *argv[], const char *envp[], fprintf(fp, "copy MAGIC with enclave sucess.\n"); fclose(fp); + *exit_code = 0; + return 0; }