Repository: mesos
Updated Branches:
  refs/heads/1.6.x 09c731c92 -> ab6478d38


Removed memcpy from os::Fork::instantiate.

GCC 8.1 warns about using `memcpy` to copy a `os::Fork::Tree::Memory`
struct because it doesn't have a trivial copy operator. We can replace
the `memcpy` with direct access to the structure fields, which has the
same effect. The struct was made a non-POD type in 4a01850c55, which
introduced the `std::atomic_bool` member.

Review: https://reviews.apache.org/r/67614/
(cherry picked from commit 594ddb30cc9bced92d296d4e08a566e03378dd85)


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/25e203dd
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/25e203dd
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/25e203dd

Branch: refs/heads/1.6.x
Commit: 25e203ddcf5247219637fda898b6e3f48cca29cf
Parents: 09c731c
Author: James Peach <[email protected]>
Authored: Fri Jun 15 16:10:36 2018 -0700
Committer: James Peach <[email protected]>
Committed: Fri Jun 15 16:12:33 2018 -0700

----------------------------------------------------------------------
 3rdparty/stout/include/stout/os/posix/fork.hpp | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/25e203dd/3rdparty/stout/include/stout/os/posix/fork.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/posix/fork.hpp 
b/3rdparty/stout/include/stout/os/posix/fork.hpp
index 098224e..83caaec 100644
--- a/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -342,16 +342,12 @@ private:
       return pid;
     }
 
-    // Set the basic process information.
-    Tree::Memory process;
-    process.pid = getpid();
-    process.parent = getppid();
-    process.group = getpgid(0);
-    process.session = getsid(0);
-    process.set.store(true);
-
-    // Copy it into shared memory.
-    memcpy(tree.memory.get(), &process, sizeof(Tree::Memory));
+    // Set the basic process information into shared memory.
+    tree.memory->pid = getpid();
+    tree.memory->parent = getppid();
+    tree.memory->group = getpgid(0);
+    tree.memory->session = getsid(0);
+    tree.memory->set.store(true);
 
     // Execute the function, if any.
     if (function.isSome()) {

Reply via email to