summaryrefslogtreecommitdiff
path: root/src/spawn.hh
diff options
context:
space:
mode:
authorChristian Persch <chpe@src.gnome.org>2020-05-03 22:18:11 +0200
committerChristian Persch <chpe@src.gnome.org>2020-05-03 22:18:11 +0200
commit0c95c0c9f376aa0a2b91c516a52181bbc9f372f5 (patch)
treee7d509f9161357eece403bf1e4507da163decda6 /src/spawn.hh
parent87943812161c45c1c33967cbfcbed487347b7c0f (diff)
downloadvte-0c95c0c9f376aa0a2b91c516a52181bbc9f372f5.tar.gz
spawn: Use unique_ptr for child setup data
Diffstat (limited to 'src/spawn.hh')
-rw-r--r--src/spawn.hh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/spawn.hh b/src/spawn.hh
index 0a2a5e58..3e12af3b 100644
--- a/src/spawn.hh
+++ b/src/spawn.hh
@@ -53,8 +53,8 @@ private:
// allocations
std::vector<std::pair<int,int>> m_fd_map{{-1, 0}, {-1, 1}, {-1, 2}};
- child_setup_type m_child_setup{(void(*)(void*))0};
- std::shared_ptr<void> m_child_setup_data{nullptr};
+ child_setup_type m_child_setup{nullptr};
+ std::unique_ptr<void, void(*)(void*)> m_child_setup_data{nullptr, nullptr};
bool m_inherit_environ{true};
bool m_systemd_scope{true};
@@ -116,9 +116,9 @@ public:
{
m_child_setup = func;
if (destroy)
- m_child_setup_data = std::shared_ptr<void>(data, destroy);
+ m_child_setup_data = {data, destroy};
else
- m_child_setup_data = std::shared_ptr<void>(data, [](auto p) { });
+ m_child_setup_data = {data, [](auto ptr){}};
}
void add_fds(int const* fds,