From 83f479ab540c7a7fa1ae87dfefbf08d92384a427 Mon Sep 17 00:00:00 2001 From: "Tate, Hongliang Tian" Date: Tue, 12 Nov 2019 16:24:45 +0000 Subject: [PATCH] Fix the return value of pal --- src/pal/pal.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pal/pal.c b/src/pal/pal.c index f24e9aff..1ffb7cd9 100644 --- a/src/pal/pal.c +++ b/src/pal/pal.c @@ -306,15 +306,15 @@ int SGX_CDECL main(int argc, const char *argv[]) if (argc < 2) { printf("ERROR: at least one argument must be provided\n\n"); printf("Usage: pal ...\n"); - return -1; + return EXIT_FAILURE; } const char* executable_path = argv[1]; /* Initialize the enclave */ - if(initialize_enclave() < 0){ + if (initialize_enclave() < 0){ printf("Enter a character before exit ...\n"); getchar(); - return -1; + return EXIT_FAILURE; } // First ecall do a lot initializations. @@ -324,9 +324,12 @@ int SGX_CDECL main(int argc, const char *argv[]) gettimeofday(&libosready, NULL); sgx_ret = libos_boot(global_eid, &status, executable_path, &argv[2]); - if(sgx_ret != SGX_SUCCESS) { + if (sgx_ret != SGX_SUCCESS) { print_error_message(sgx_ret); - return status; + return EXIT_FAILURE; + } + if (status != 0) { + return EXIT_FAILURE; } // TODO: exit all tasks gracefully, instead of killing all remaining