Rework nest protection
This commit is contained in:
parent
8a2624ca2f
commit
b30363cc54
@ -66,6 +66,7 @@ Firestarter, in addition to spawning the programs in the default configs, also i
|
||||
| 53 | Failed to create logging directory |
|
||||
| 54 | `HOME` does not exist or is unreadable |
|
||||
| 55 | Firestarter is already running |
|
||||
| 56 | Firestarter is not running |
|
||||
| 70 | No configuration files available |
|
||||
|
||||
## Idiosyncracies
|
||||
|
18
firestarter
18
firestarter
@ -148,7 +148,9 @@ fslist() {
|
||||
}
|
||||
fsstatus() {
|
||||
# List statistics about firestarter
|
||||
warn "NYI"
|
||||
if [ -z "$FIRESTARTER" ]; then
|
||||
error "Firestarter is not currently running" 56
|
||||
fi
|
||||
}
|
||||
step_preexecute() {
|
||||
# Special things that can't use simple configuration files
|
||||
@ -421,19 +423,7 @@ main() {
|
||||
done
|
||||
# Early hook for help
|
||||
[ -n "$_opthelp" ] && printhelp && exit 0
|
||||
# Ensure our running environment is sane and that we're not about to nest
|
||||
if [ -z "$_optdryrun" ]; then
|
||||
for pid in $(pgrep firestarter); do
|
||||
# Skip invalid PIDs
|
||||
! [ -d "$/proc/$pid" ] && continue
|
||||
# If it's not our session then who cares
|
||||
[ "$_sessionid" != "$(< "/proc/$pid/sessionid")" ] && continue
|
||||
# If it's us then who cares
|
||||
[ "$pid" == "$BASHPID" ] && continue
|
||||
# We care
|
||||
error "Firestarter is already running: $pid" 40
|
||||
done
|
||||
fi
|
||||
# Ensure our running environment is sane
|
||||
if ! [ -d "$HOME" ] || ! [ -r "$HOME" ]; then
|
||||
error "Home directory not found or inaccessable: \"$HOME\"" 54
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user