vendor: update github.com/coreos/go-systemd/v22 to latest main

This fixes a CI flake. go-systemd was not handling the dlerror()
function correctly which lead to wrong errors being reported.

[NO NEW TESTS NEEDED]

Fixes #20569

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-11-03 14:53:58 +01:00
parent 0904c19422
commit ce334ed9dd
5 changed files with 15 additions and 5 deletions

View File

@ -23,6 +23,7 @@ import "C"
import (
"errors"
"fmt"
"runtime"
"unsafe"
)
@ -56,6 +57,10 @@ func GetHandle(libs []string) (*LibHandle, error) {
// GetSymbolPointer takes a symbol name and returns a pointer to the symbol.
func (l *LibHandle) GetSymbolPointer(symbol string) (unsafe.Pointer, error) {
// Locking the thread is critical here as the dlerror() is thread local so
// go should not reschedule this onto another thread.
runtime.LockOSThread()
defer runtime.UnlockOSThread()
sym := C.CString(symbol)
defer C.free(unsafe.Pointer(sym))
@ -71,6 +76,10 @@ func (l *LibHandle) GetSymbolPointer(symbol string) (unsafe.Pointer, error) {
// Close closes a LibHandle.
func (l *LibHandle) Close() error {
// Locking the thread is critical here as the dlerror() is thread local so
// go should not reschedule this onto another thread.
runtime.LockOSThread()
defer runtime.UnlockOSThread()
C.dlerror()
C.dlclose(l.Handle)
e := C.dlerror()

View File

@ -59,7 +59,7 @@ package sdjournal
// void
// my_sd_journal_close(void *f, sd_journal *j)
// {
// int (*sd_journal_close)(sd_journal *);
// void (*sd_journal_close)(sd_journal *);
//
// sd_journal_close = f;
// sd_journal_close(j);
@ -104,7 +104,7 @@ package sdjournal
// void
// my_sd_journal_flush_matches(void *f, sd_journal *j)
// {
// int (*sd_journal_flush_matches)(sd_journal *);
// void (*sd_journal_flush_matches)(sd_journal *);
//
// sd_journal_flush_matches = f;
// sd_journal_flush_matches(j);