From bc93085f4e9062fd99f729f0d39f236536a0b65a Mon Sep 17 00:00:00 2001 From: haosanzi Date: Tue, 25 Aug 2020 10:30:24 +0800 Subject: [PATCH] rune/libenclave: Revert the workaround for omitting argv[0] Signed-off-by: shirong --- rune/libenclave/internal/runtime/pal/api_linux_v2.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rune/libenclave/internal/runtime/pal/api_linux_v2.go b/rune/libenclave/internal/runtime/pal/api_linux_v2.go index 9e7a65e..b0dab05 100644 --- a/rune/libenclave/internal/runtime/pal/api_linux_v2.go +++ b/rune/libenclave/internal/runtime/pal/api_linux_v2.go @@ -76,12 +76,11 @@ func (pal *enclaveRuntimePalApiV2) exec(cmd []string, envs []string, stdio [3]*o // Skip cmd[0] as used as the executable. var exe *C.char - argc := len(cmd) + argc := len(cmd) + 1 pargs := make([]*C.char, argc) exe = C.CString(cmd[0]) defer C.free(unsafe.Pointer(exe)) if argc > 1 { - cmd = cmd[1:] for i, arg := range cmd { logrus.Debugf("arg[%d]: %s", i, arg) pargs[i] = C.CString(arg) -- GitLab