This expands to __attribute__((flag_enum)) if available. It is useful when
using clang-tidy to do static analysis, which will warn about code like
(GParamFlags)(G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE).
This makes sure that extensions can generate code at the expected
places, and change the GDBusInterfaceSkeleton subtype that generated
skeletons derive from.
This allows us to create a copy of an argument without going through
GValue. The codegen here does not have any use for it, but we will add
an extension system in a later commit. The libdex codegen extension will
make use of it to define a boxed type for the method return values.
The out type can be different from the in types in their qualifiers and
thus are not always simply a reference to the in type. However, the out
types used to include the reference instead of the "base" type because
the code generator always used them in places where we actually needed a
reference to the out type (e.g. as out params).
For example, the codegen here generates:
gboolean dex_dbus_ping_pong_call_ping_sync (
DexDbusPingPong *proxy,
const gchar *arg_name,
gchar ** out_pong,
GCancellable *cancellable,
GError **error);
Where `gchar **` is the out type. If we want to codegen a function which
returns the out params in a struct, it would need to look like this:
typedef struct _DexDbusPingPongPingResult
{
gchar * pong;
} DexDbusPingPongPingResult;
Where neither the out type `gchar **` nor the in type `const gchar *` is
appropriate.
This changes the ctype_out to be the base type, and makes the codegen
add the reference explicitly.
Contrary to MSDN documentation, GetThreadPriority() may return
undocumented priority values that SetThreadPriority() cannot accept.
This can happen, for example, when a high-priority process uses
MMCSS to modify thread priority levels.
Since failure to update thread priority is not critical and users
can adjust it later, do not treat such failures as errors
A mount table is inherently trusted, so this isn't really a security
issue, but let's not write out of bounds. If anybody is still using GLib
on AIX, then you're welcome.
Discovery and patch credit: mhzcyber - Mohammad Hussam Alzeyyat
(I, Michael, only wrote this commit message and adjusted the
whitespace.)
This previous behavior violates RFC-1123 which updated the original
RFC-952.
Patch originally from Ulrich Drepper.
Fixes: #3523
Signed-off-by: Christian Hergert <chergert@redhat.com>
This adds the condition that a new unix address is tried only when there
is enough space to append random character(s) before the address reach
the length of UNIX_PATH_MAX.
Before this change, creating a GDBusServer with unix addresses longer
than UNIX_PATH_MAX that existed in the filesystem would never return. A
test that expects G_IO_ERROR_ADDRESS_IN_USE in such scenario was added.
The code stripped all but the first trailing slash in order to handle
the absolute root path "/". This breaks the removal of trailing slashes
for paths starting with $HOME, though.
Fix the logic to remove all trailing slashes if $HOME is encountered.
Closes#3811
The return value from `fread()` doesn’t actually indicate whether the
read failed due to EOF or due to a read error.
Rework the code so that errors are reported correctly, EOF is handled
silently, and as a byproduct, blank lines in the input file are ignored
and skipped over.
Spotted by scan-build.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Error handling in `fread()` is too complex, and the code explicitly
disables the buffering feature of `FILE`, so there’s little point in
using it.
Instead, use `open()`/`read()` directly. This avoids any buffering
issues, and gives us use of `errno` to check errors. `ferror()` doesn’t
give us any more information than “there was an error”.
This fixes an issue flagged by scan-build: that a failure in the first
`fread()` loop iteration would leave the `FILE` in an undefined state
(in particular, an undefined seek position) which would mess up the next
iteration. Since `ferror()` couldn’t actually tell us what the error was
(was it `EINTR`?) and `errno` is not guaranteed to be set by `fread()`,
the whole approach was doomed.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
If asked to replace a file (i.e. effectively delete and re-create it)
which is a symlink, in a read-only directory, the code would end up
trying to do operations on an invalid `fd`. This was masked when asked
to create a backup, as creating the backup in the read-only
directory would error out just in time.
Make the code a bit more robust in this situation, and add some unit
tests.
Spotted by scan-build.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Rather than passing it to `dup2()`, which scan-build thinks could cause
problems (I would have thought `dup2()` would just return `EBADF`, but
perhaps some implementations are buggy?).
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fallback for non-Linux systems that support the _SC_PHYS_PAGES and
_SC_AVPHYS_PAGES sysconf selectors, such as Solaris & OpenBSD.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Solaris inherited the SVR4 sysinfo() function, which takes a different
number of arguments from Linux, and provides information such as host
name and OS version, but not information on free or total memory.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
When the error is defined in a new enough PCRE2 we should handle it.
However let's not define an error message for this in this commit (just
let's use the old one that is generic enough), so that it can be backported
to stable versions without having to require new translations.
Closes: #3809
This test applies to both old and newer versions of PCRE2 where
back reference error has now increased the granularity and is referred
as PCRE2_ERROR_MISSING_NUMBER_TERMINATOR instead.
Co-Authored-By: Marco Trevisan <mail@3v1n0.net>