- Fix indentation
- Remove unnecessary {} around variables
- Double-quote all variables when assigned or used as arguments
- Simplify quotes and escaping in creation of the superuser file
- Remove needless variable assignments
- Use $() for command substitution instead of ``
Fix handling of legacy configuration directories in debian/postinst
Detect if the HTS user's home directory starts with "/home/", which
indicates the legacy configuration directory is in use, and use the
correct paths for the "recordings" directory and "superuser" file.
This prevents a useless files/directories from being created and
ensures that "dpkg-reconfigure tvheadend" still updates the
superuser credentials correctly.
c7f46ec...
by
"sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com>
main: Warn about unexpected configuration location
When using the `--fork` flag, and no user or config arguments are
supplied, the configuration folder will end up with whatever the default
`daemon` user has set, which is often `/sbin` set as the homedir.
This is weird, but not 'wrong' per say. Lets warn the user that forking
can have an unexpected side effect.
The behavior of signal() is not consistent or defined when using it
to set signal handlers (see "Portability" in https://man7.org/linux/man-pages/man2/signal.2.html). Previously
we got away with this, but starting with GCC 14, using signal()
apparently causes certain syscalls to be restarted after the signal
is caught. One of these is the read() currently on line 63 of
fsmonitor.c. The result is that read() doesn't return when the
fsmonitor thread receives a signal, resulting in the thread never
shutting down, resulting in TVHeadend hanging on any attempt to
terminate it.
Instead, use sigaction(), which has defined behavior when setting
signal handlers. Since invoking sigaction() requires several
lines, a helper was added to tvh_thread.c to avoid code
duplication.