[CRIU] [PATCH] pstree: Avoid double getpid() call
Radostin Stoyanov
rstoyanov1 at gmail.com
Sun Oct 28 23:42:35 MSK 2018
On 28/10/2018 19:26, Dmitry Safonov wrote:
> On 10/28/18 11:06 AM, Radostin Stoyanov wrote:
>> 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);
>
> I like it. Can you add pid_t as a parameter and eliminate another call
> in prepare_pstree_ids()?
>
Thanks Dima, I will resend the patch.
Radostin
More information about the CRIU
mailing list