@@ -1378,6 +1378,7 @@ void wait_create_runtime_result(const linyaps_box::config &config, linyaps_box::
13781378}
13791379
13801380void create_container_hooks (const linyaps_box::container &container,
1381+ const linyaps_box::container_status_t &status,
13811382 linyaps_box::unix_socket &socket)
13821383{
13831384 const auto &config = container.get_config ();
@@ -1387,9 +1388,8 @@ void create_container_hooks(const linyaps_box::container &container,
13871388
13881389 LINYAPS_BOX_DEBUG () << " Execute create container hooks" ;
13891390
1390- auto state = container.status ();
13911391 for (const auto &hook : config.hooks .create_container .value ()) {
1392- execute_hook (hook, state );
1392+ execute_hook (hook, status );
13931393 }
13941394
13951395 LINYAPS_BOX_DEBUG () << " Create container hooks executed" ;
@@ -1598,6 +1598,7 @@ void set_capabilities(const linyaps_box::config &config, int last_cap)
15981598}
15991599
16001600void start_container_hooks (const linyaps_box::container &container,
1601+ const linyaps_box::container_status_t &status,
16011602 linyaps_box::unix_socket &socket)
16021603{
16031604 const auto &config = container.get_config ();
@@ -1607,9 +1608,8 @@ void start_container_hooks(const linyaps_box::container &container,
16071608
16081609 LINYAPS_BOX_DEBUG () << " Execute start container hooks" ;
16091610
1610- auto state = container.status ();
16111611 for (const auto &hook : config.hooks .start_container .value ()) {
1612- execute_hook (hook, state );
1612+ execute_hook (hook, status );
16131613 }
16141614
16151615 LINYAPS_BOX_DEBUG () << " Start container hooks executed" ;
@@ -1789,7 +1789,9 @@ try {
17891789 configure_mounts (container, rootfs);
17901790 wait_prestart_hooks_result (config, socket);
17911791 wait_create_runtime_result (config, socket);
1792- create_container_hooks (container, socket);
1792+
1793+ auto status = container.status ();
1794+ create_container_hooks (container, status, socket);
17931795 // TODO: selinux label/apparmor profile
17941796 do_pivot_root (container, rootfs);
17951797
@@ -1809,7 +1811,7 @@ try {
18091811 linyaps_box::utils::sigprocmask (SIG_UNBLOCK, set, nullptr );
18101812 linyaps_box::utils::reset_signals (set);
18111813
1812- start_container_hooks (container, socket);
1814+ start_container_hooks (container, status, socket);
18131815 execute_process (config);
18141816} catch (const std::system_error &e) {
18151817 LINYAPS_BOX_ERR () << " clone failed: " << e.what ();
0 commit comments