Removed redundant `struct` prefix in "linux/ns.cpp".

Review: https://reviews.apache.org/r/64807/


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

Branch: refs/heads/master
Commit: 223aad37ee034283c82afa9b33a7db9d4959646c
Parents: 5517db0
Author: Alexander Rukletsov <ruklet...@gmail.com>
Authored: Fri Dec 22 19:42:01 2017 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Fri Dec 22 19:46:25 2017 +0100

----------------------------------------------------------------------
 src/linux/ns.cpp | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/223aad37/src/linux/ns.cpp
----------------------------------------------------------------------
diff --git a/src/linux/ns.cpp b/src/linux/ns.cpp
index be59d9c..4466407 100644
--- a/src/linux/ns.cpp
+++ b/src/linux/ns.cpp
@@ -319,15 +319,15 @@ Try<pid_t> clone(
   iov.iov_base = base;
   iov.iov_len = sizeof(base);
 
-  // We need to allocate a char array large enough to hold "control" data. 
However,
-  // since this buffer is in reality a 'struct cmsghdr' with the payload, we 
use
-  // a union to ensure that it is aligned as required for that structure.
+  // We need to allocate a char array large enough to hold "control" data.
+  // However, since this buffer is in reality a 'cmsghdr' with the payload, we
+  // use a union to ensure that it is aligned as required for that structure.
   union {
-    struct cmsghdr cmessage;
-    char control[CMSG_SPACE(sizeof(struct ucred))];
+    cmsghdr cmessage;
+    char control[CMSG_SPACE(sizeof(ucred))];
   };
 
-  cmessage.cmsg_len = CMSG_LEN(sizeof(struct ucred));
+  cmessage.cmsg_len = CMSG_LEN(sizeof(ucred));
   cmessage.cmsg_level = SOL_SOCKET;
   cmessage.cmsg_type = SCM_CREDENTIALS;
 
@@ -337,7 +337,7 @@ Try<pid_t> clone(
   message.msg_iov = &iov;
   message.msg_iovlen = 1;
   message.msg_control = control;
-  message.msg_controllen = sizeof(control); // CMSG_LEN(sizeof(struct ucred));
+  message.msg_controllen = sizeof(control); // CMSG_LEN(sizeof(ucred));
 
   // Finally, the stack we'll use in the call to os::clone below (we
   // allocate the stack here in order to keep the call to os::clone
@@ -389,16 +389,15 @@ Try<pid_t> clone(
 
     // Extract pid.
     if (CMSG_FIRSTHDR(&message) == nullptr ||
-        CMSG_FIRSTHDR(&message)->cmsg_len != CMSG_LEN(sizeof(struct ucred)) ||
+        CMSG_FIRSTHDR(&message)->cmsg_len != CMSG_LEN(sizeof(ucred)) ||
         CMSG_FIRSTHDR(&message)->cmsg_level != SOL_SOCKET ||
         CMSG_FIRSTHDR(&message)->cmsg_type != SCM_CREDENTIALS) {
       kill(child, SIGKILL);
       return Error("Bad control data received");
     }
 
-    struct ucred cred;
-    std::memcpy(
-        &cred, CMSG_DATA(CMSG_FIRSTHDR(&message)), sizeof(struct ucred));
+    ucred cred;
+    std::memcpy(&cred, CMSG_DATA(CMSG_FIRSTHDR(&message)), sizeof(ucred));
 
     const pid_t pid = cred.pid;
 
@@ -458,7 +457,7 @@ Try<pid_t> clone(
           stack.get(),
           flags,
           [=]() {
-            struct ucred cred;
+            ucred cred;
             cred.pid = ::getpid();
             cred.uid = ::getuid();
             cred.gid = ::getgid();
@@ -469,9 +468,7 @@ Try<pid_t> clone(
             // NOTE: sending back the pid is best effort because we're going
             // to exit no matter what.
             std::memcpy(
-                CMSG_DATA(CMSG_FIRSTHDR(&message)),
-                &cred,
-                sizeof(struct ucred));
+                CMSG_DATA(CMSG_FIRSTHDR(&message)), &cred, sizeof(ucred));
 
             if (sendmsg(sockets[1], &message, 0) == -1) {
               // Failed to send the pid back to the parent!

Reply via email to