@@ -31,7 +31,7 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid)
31
31
userShellName = instance .state .platform .userShell .chars + index + 1 ;
32
32
}
33
33
34
- while (ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , & tty ) == NULL )
34
+ while (pid > 1 && ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , & tty ) == NULL )
35
35
{
36
36
if (!ffStrbufEqualS (& result -> processName , userShellName ))
37
37
{
@@ -75,14 +75,14 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid)
75
75
ffProcessGetInfoLinux (pid , & result -> processName , & result -> exe , & result -> exeName , & result -> exePath );
76
76
break ;
77
77
}
78
- return ppid ;
78
+ return pid > 1 ? ppid : 0 ;
79
79
}
80
80
81
81
static pid_t getTerminalInfo (FFTerminalResult * result , pid_t pid )
82
82
{
83
83
pid_t ppid = 0 ;
84
84
85
- while (ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , NULL ) == NULL )
85
+ while (pid > 1 && ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , NULL ) == NULL )
86
86
{
87
87
//Known shells
88
88
if (
@@ -145,7 +145,7 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid)
145
145
ffProcessGetInfoLinux (pid , & result -> processName , & result -> exe , & result -> exeName , & result -> exePath );
146
146
break ;
147
147
}
148
- return ppid ;
148
+ return pid > 1 ? ppid : 0 ;
149
149
}
150
150
151
151
static bool getTerminalInfoByPidEnv (FFTerminalResult * result , const char * pidEnv )
0 commit comments