[CRIU] [PATCH] pstree: Avoid double getpid() call

Radostin Stoyanov rstoyanov1 at gmail.com
Sun Oct 28 14:06:01 MSK 2018


Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/pstree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/criu/pstree.c b/criu/pstree.c
index 928fe2d1..ba9ff993 100644
--- a/criu/pstree.c
+++ b/criu/pstree.c
@@ -335,8 +335,9 @@ err:
 
 static int prepare_pstree_for_shell_job(void)
 {
-	pid_t current_sid = getsid(getpid());
-	pid_t current_gid = getpgid(getpid());
+	pid_t current_pid = getpid();
+	pid_t current_sid = getsid(current_pid);
+	pid_t current_gid = getpgid(current_pid);
 
 	struct pstree_item *pi;
 
-- 
2.17.2



More information about the CRIU mailing list