unlink
OBS-URL: https://build.opensuse.org/package/show/Cloud:Tools/aws-nitro-enclaves-cli?expand=0&rev=4
This commit is contained in:
parent
452078a00d
commit
2949309811
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user