POSIX states that the return value of isdigit(): "shall return non-zero
if c is a decimal digit; otherwise, they shall return 0."
Thus the form:
ok &= isdigit(x)
is invalid since the runtime is not required to return 1.
This bug was observed on Debian 11 while using the clang toolchain.
In that environment, isdigit() returns 2048 for a positive match.
During testing in a sandbox environment, xlxd crashed in
CG3Protocol::Close(). The root cause was dereferencing
m_pPresenceThread when the object had never been initialized.
In this case an error occured during ::Init() which set ok=false,
so the initialization of the threads was skipped.
This commit does 3 things:
(1) Default initializes the thread pointers to avoid the crash.
(2) Wraps the thread allocation with try/catch since std::thread can
throw.
(3) Does some light cleaning in ::Close, e.g., converting NULL to
nullptr.
This is a general refactor of the makefile with the introduction of
staged install.
Is now possible to install with make install DESTDIR=build
and it will build the default xlxd install structure under the build
folder.
This if extremely usefull for building deb packages without using root
user and without interfeering with the host xlxd installation.
It also define some standard make directory variables, all defaulted
to /xlxd, to better customize the software at compile time.
make staged install:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
make directory variables:
https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html
the static Ip var was being shared by all instances of cstream class, then using same ambed by multiple xlxd's (on different ip's) would be a problem, we can just use m_Ip (that already stores the ip of the client reflector, set by controller class when creating cstream) to send packets back