'obj->classIdMap' is a bitmap with size of '16', thus the first 3 bits
are guaranteed to be available. Use 'virBitmapSetBit' instead of
'virBitmapSetBitExpand' since we don't need any expansion and ignore
errors as they are impossible.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Use a temporary auto-freed local variable to hold the hash table so that
the cleanup section can be removed.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Allocate the hash tables first so tat the 'data' struct can be directly
initialized removing the need for a memset and two additional
assignments.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
Declare the function with G_GNUC_WARN_UNUSED_RESULT as we always want to
use the returned value.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
In one of my previous patches I've tried to postpone dropping
CAP_SETPCAP until the very end because it's needed for
capng_apply(). What I did not realize back then was that we might
not have the capability to begin with. Because of unknown reasons
capng_apply() pollutes logs only for CAPNG_SELECT_BOUNDS and not
for CAPNG_SELECT_CAPS.
Reproducer is really simple: run libvirtd as a regular user.
During its initialization, libvirtd will spawn some binaries
(dnsmasq, qemu-*, etc.) and while doing so it will try to drop
capabilities.
Anyway, let's call capng_apply(CAPNG_SELECT_BOUNDS) only if we
have the CAP_SETPCAP (which is tracked in need_setpcap variable).
Fixes: 438b50dda8
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1924218
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
After all capabilities were set (except for CAP_SETGID,
CAP_SETUID and CAP_SETPCAP) and after UID:GID was changed we drop
the last aforementioned capabilities (we couldn't drop them
before because we needed UID:GID and capabilities change).
Therefore, there's final capng_apply() call. However, it is
wrapped in one layer of parenthesis more than needed.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Currently translated at 49.6% (5132 of 10342 strings)
Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/de/
Co-authored-by: Christian Kirbach <christian.kirbach@gmail.com>
Signed-off-by: Christian Kirbach <christian.kirbach@gmail.com>
Libvirt is using the G_GNUC_FALLTHROUGH macro provided by glib since
version 2.60. Since we need to support older glib, we also have some
compatibility code to define it if missing.
We set the GLIB_VERSION_MAX_ALLOWED macro to ensure we get warnings
when we use an API that dates from a glib version newer than our
minimum benchmark. Historically this didn't get enforced for (most)
macros, but GLib 2.69 has addressed that gap.
This causes our usage of G_GNUC_FALLTHROUGH to trigger warnings.
GLib is right to warn, because it does not know that we have added
our own fallback for older versions.
The only way to squelch this warning though, is to fully undefine
the GLib provided G_GNUC_FALLTHROUGH and use our own in its place.
We'll be able to remove all this compat burden when we finally
update the min glib version to be >= 2.60
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
If lvcreate found an existing signature when trying to create a
new logical volume (E.g. left after some deleted volume), the
action failed due to inability to answer interactive question to
wiping it (lvcreate assumed 'no' was the answer). With added
option --yes to the command line, the answer to any interactive
question is assumed to be yes. Therefore, lvcreate wipes the
signature and the new volume is created successfully.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1940413
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>