mirror of
https://github.com/eepykate/fet.sh.git
synced 2026-10-24 11:54:34 +00:00
Make sure not to do an infinite loop
This commit is contained in:
1 parent
8b3af10779
commit
81d4666525
1 file changed
+5
@@ -36,8 +36,13 @@ if [ -e /proc/$$/comm ]; then
|
||||
eq "$line" "PPid*" && ppid=${line##*:?} && break
|
||||
done < "/proc/${ppid:-$PPID}/status"
|
||||
|
||||
# Make sure not to do an infinite loop
|
||||
[ "$pppid" = "$ppid" ] && break
|
||||
pppid="$ppid"
|
||||
|
||||
# get name of binary
|
||||
read -r name < "/proc/$ppid/comm"
|
||||
|
||||
case $name in
|
||||
*sh|"${0##*/}") ;; # skip shells
|
||||
*[Ll]ogin*|*init*) break;; # exit when the top is reached
|
||||
|
||||
Reference in new issue
Block a user