Remove fifo before creating it. Remove fifo on SIGTERM.
This commit is contained in:
parent
99a1b72a26
commit
6f89e169c8
1 changed files with 6 additions and 4 deletions
10
lumberjack
10
lumberjack
|
|
@ -297,6 +297,9 @@ sigterm_handler() {
|
||||||
close_fd "$SITE"
|
close_fd "$SITE"
|
||||||
done
|
done
|
||||||
disown -a
|
disown -a
|
||||||
|
(( FLAGS[created-fifo] == 1 )) && {
|
||||||
|
rm -f "$INPUT" 2>/dev/null || syslog "warn" "failed to remove pipe/fifo: $INPUT"
|
||||||
|
}
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -557,14 +560,13 @@ TEMPLATE="$2"
|
||||||
|
|
||||||
# If input is to be a pipe/FIFO, create it if necessary.
|
# If input is to be a pipe/FIFO, create it if necessary.
|
||||||
[[ -n "$INPUT" ]] && {
|
[[ -n "$INPUT" ]] && {
|
||||||
if [[ ! -e "$INPUT" ]]; then
|
[[ ! -e "$INPUT" ]] || [[ ! -p "$INPUT" ]] && {
|
||||||
umask "$PIPE_UMASK"
|
umask "$PIPE_UMASK"
|
||||||
|
rm -f "$INPUT"
|
||||||
mkfifo "$INPUT" 2>/dev/null || die "failed to create pipe/FIFO: $INPUT"
|
mkfifo "$INPUT" 2>/dev/null || die "failed to create pipe/FIFO: $INPUT"
|
||||||
FLAGS[created-fifo]=1
|
FLAGS[created-fifo]=1
|
||||||
[[ -n "$PIPE_OWNER" ]] && { chown "$PIPE_OWNER" "$INPUT" >/dev/null 2>&1 || die "failed to chown pipe/FIFO: $INPUT"; }
|
[[ -n "$PIPE_OWNER" ]] && { chown "$PIPE_OWNER" "$INPUT" >/dev/null 2>&1 || die "failed to chown pipe/FIFO: $INPUT"; }
|
||||||
elif [[ ! -p "$INPUT" ]]; then
|
}
|
||||||
die "not a pipe/FIFO: $INPUT"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Apply user and setting.
|
# Apply user and setting.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue