* commit 'a159b58790cf980df375faa5a55fb713faf257c5':
fix missing "/" in path
add support for cache directory make configs use specific directory variables instead of just base_dir so that one configuration can be used for fhs and legacy installations
In `sofia status gateway ...` let's show the uptime in seconds rather
than in microseconds. We'll output the uptime in microseconds in
`xmlstatus` and we'll label it as such.
The 'UP' status indicates a gateway is online as determined by
registration and/or SIP OPTIONS pinging.
The time the gateway has been in the 'UP' status is recorded,
and can be monitored using 'sofia status' and 'sofia xmlstatus'.
This can be used to detect and graph when there are outages.
ref: FS-6772
Reviewed-by: Travis Cross <tc@traviscross.com>
What if the hash were destroyed by one thread holding the lock while
another thread was waiting for the lock? The waiting thread would
have already checked that the hash was non-null and would proceed on
that assumption after acquiring the lock.
With this commit we check only after acquiring the lock.
ref: FS-6783
ref: FS-6775
`switch_core_hash_first` allocates an iterator on each call that is
never freed except when the hash table is empty.
By using `switch_core_hash_first_iter` we allocate only one iterator,
and that iterator is freed after the last item is processed.
We're using -Wno-unused-result to work around what is arguably a GCC
bug, but this option is not supported on older GCC versions. So on
those versions we won't pass -Werror either.
ref: commit b874048efc
It's reasonable for someone to change one or more of these directory
permissions after installation. We shouldn't touch more than we need
on upgrade. Each directory needs to be owned by the freeswitch user,
but past that we can leave discretion to the system administrator.
In some configurations where many limits are used, the limit increases
and releases were generating a lot of noise and making it harder to
see when limits were exceeded, which was at the same log level.
As an example of using mod_sofia's gateway parameter `contact-params`
we'd used the value `tport=tcp`. Looking around, it's clear this has
misled people into believing you can specify `tport=tcp` to make the
gateway use TCP or `tport=tls` to make the gateway use TLS. This does
not work.
The actual contact parameter is named `transport` rather than `tport`,
and you shouldn't use `transport` in `contact-params` because we
automatically add a `transport` to the Contact: based on the value of
`register-transport` (even if the gateway is set to not register).
It's clear why this would be confusing, so we'll just remove this as
an example.
In some cases where `redisplay()` is called immediately after a
command is run (e.g. `log ...`) we often get a prompt, junk output,
and a second prompt. This is due to a (known) race.
We believe we're falling afoul of this code in `el_deletestr`:
if (el->el_line.cursor < &el->el_line.buffer[n])
return;
Basing the length of text to delete off of the cursor position
resolves the issue of junk text, but the real solution is to eliminate
the race conditions, which will also resolve the sometimes duplicated
prompt.
FS-6764 #resolve
Thanks-to: Nathan Neulinger <nneul@neulinger.org>
Modern static analyzers warn when a variable is set but not used. GCC
warns when the result of a function marked as
`__attribute__((warn_unused_result))` is not set to some variable,
even when the function is cast to `(void)`, which is the recognized
way of indicating the intent to ignore the result. We treat all
warnings as errors.
The combination of behaviors here makes it difficult if we really
don't care about the result of the function; the obvious workarounds
are precluded.
GCC's maintainers don't consider this to be a bug:
Why do you think this is a bug? warn_unused_result is for cases where
"not checking the result is either a security problem or always a
bug".
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509#c1
GLIBC however marks functions like `read` and `write` with this
attribute. While it certainly in most cases is correct to act on
their return value, in some cases we really just don't care.
So when we see that we're building with GCC, and that we're building
with all warnings enabled, we'll just pass -Wno-unused-result to
disable the warning.
ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
ref: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
Clang's static analyzer thinks we could be using `hosts` here when it
is NULL. We probably weren't, but it's easy to see how it could think
so. We were checking whether `from_addr` matched `ice->addr` three
times, and between the second on third time we might have modified the
`ice->addr`; however we only get there if it matched the second time,
so we could only make it not match at that point and avoid the third
branch. We can't make it match where it did not before.
We'll simplify the logic a bit here so static analyzers (and humans)
can hopefully see this more readily.
When zero was passed for the size to `sub_alloc`, we were passing this
size on to `malloc` or `calloc`, which is unusual enough that static
analyzers warn about this (POSIX says that either NULL or a pointer
will be returned).
We'll instead just return NULL right away.