@@ -31,7 +31,7 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid)
3131 userShellName = instance .state .platform .userShell .chars + index + 1 ;
3232 }
3333
34- while (ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , & tty ) == NULL )
34+ while (pid > 1 && ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , & tty ) == NULL )
3535 {
3636 if (!ffStrbufEqualS (& result -> processName , userShellName ))
3737 {
@@ -75,14 +75,14 @@ static pid_t getShellInfo(FFShellResult* result, pid_t pid)
7575 ffProcessGetInfoLinux (pid , & result -> processName , & result -> exe , & result -> exeName , & result -> exePath );
7676 break ;
7777 }
78- return ppid ;
78+ return pid > 1 ? ppid : 0 ;
7979}
8080
8181static pid_t getTerminalInfo (FFTerminalResult * result , pid_t pid )
8282{
8383 pid_t ppid = 0 ;
8484
85- while (ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , NULL ) == NULL )
85+ while (pid > 1 && ffProcessGetBasicInfoLinux (pid , & result -> processName , & ppid , NULL ) == NULL )
8686 {
8787 //Known shells
8888 if (
@@ -145,7 +145,7 @@ static pid_t getTerminalInfo(FFTerminalResult* result, pid_t pid)
145145 ffProcessGetInfoLinux (pid , & result -> processName , & result -> exe , & result -> exeName , & result -> exePath );
146146 break ;
147147 }
148- return ppid ;
148+ return pid > 1 ? ppid : 0 ;
149149}
150150
151151static bool getTerminalInfoByPidEnv (FFTerminalResult * result , const char * pidEnv )
0 commit comments