]> git.ipfire.org Git - thirdparty/libvirt.git/commit
libvirt_nss: Fix ERROR() macro
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 18 Apr 2024 07:25:07 +0000 (09:25 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 18 Apr 2024 12:57:30 +0000 (14:57 +0200)
commit753064963ce35434c91e3b6ae6bfcd1754197db2
tree09e57af367ca3784dfeeeb3fe9afd3036bab074e
parente314a8fe91ed7472a24f44f9d5e88e4abb52f96a
libvirt_nss: Fix ERROR() macro

The purpose of ERROR() macro in our NSS module is to print error
message provided as arguments followed by error string
corresponding to errno. Historically, we've used strerror_r() for
that (please note, we want our NSS module to be free of libvirt
internal functions, or glib even - hence, g_strerror() is off the
table).

Now strerror_r() is documented as:

  Returns ... a pointer to a string that the function stores in
  buf, or a pointer to some (immutable) static string (in which
  case buf is unused).

Therefore, we can't rely the string being stored in the buf and
really need to store the retval and print that instead.

While touching this area, decrease the ebuf size, since its
current size (1KiB) is triggering our stack limit (2KiB) in some
cases.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
tools/nss/libvirt_nss.h