From 29493098118fe99450605531e59a8eb1d66e14d19b3b3299b361e494ab9a8bf4 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 23 Nov 2021 15:09:48 +0000 Subject: [PATCH] unlink OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/aws-nitro-enclaves-cli?expand=0&rev=4 --- aws-nitro-enclaves-cli.patch | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/aws-nitro-enclaves-cli.patch b/aws-nitro-enclaves-cli.patch index 1d33820..4735d4e 100644 --- a/aws-nitro-enclaves-cli.patch +++ b/aws-nitro-enclaves-cli.patch @@ -17,29 +17,23 @@ Err(DockerError::InspectError) --- a/init.c +++ b/init.c -@@ -381,11 +381,11 @@ void init_nsm_driver() { - if (fd < 0 && errno == ENOENT) { - return; - } -- die_on(fd < 0, "failed to open nsm fd"); -+ die_on(0&& fd < 0, "failed to open nsm fd"); - rc = finit_module(fd, "", 0); -- die_on(rc < 0, "failed to insert nsm driver"); -+ die_on(0&& rc < 0, "failed to insert nsm driver"); +@@ -386,6 +386,9 @@ void init_nsm_driver() { + die_on(rc < 0, "failed to insert nsm driver"); -- die_on(close(fd), "close nsm fd"); -+ die_on(0&& close(fd), "close nsm fd"); + die_on(close(fd), "close nsm fd"); ++ rc = unlink(NSM_PATH); ++ if (rc < 0) ++ warn("Could not unlink " NSM_PATH); } int main() { -@@ -399,6 +399,10 @@ int main() { - init_dev(); - init_console(); +@@ -418,6 +421,9 @@ int main() { + fclose(env_file); + fclose(cmd_file); -+ char *pre_init[] = { "/rootfs/pre_init.sh", NULL , }; -+ pid_t pre_pid = launch(pre_init, NULL); -+ reap_until(pre_pid); ++ unlink("/env"); ++ unlink("/cmd"); + - // Insert the Nitro Secure Module driver - init_nsm_driver(); + die_on(chdir("/rootfs") != 0, "chdir /rootfs"); + die_on(chroot("/rootfs") != 0, "chroot /rootfs");