nss-mymachines: initialize logging
No logging is done directly by nss-mymachines.c code, but we call into sd-bus, which will log.
This commit is contained in:
parent
3339381f22
commit
e5d5edc3ff
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <nss.h>
|
#include <nss.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "sd-bus.h"
|
#include "sd-bus.h"
|
||||||
#include "sd-login.h"
|
#include "sd-login.h"
|
||||||
|
@ -14,12 +15,27 @@
|
||||||
#include "format-util.h"
|
#include "format-util.h"
|
||||||
#include "hostname-util.h"
|
#include "hostname-util.h"
|
||||||
#include "in-addr-util.h"
|
#include "in-addr-util.h"
|
||||||
|
#include "log.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
#include "memory-util.h"
|
#include "memory-util.h"
|
||||||
#include "nss-util.h"
|
#include "nss-util.h"
|
||||||
#include "signal-util.h"
|
#include "signal-util.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
|
|
||||||
|
static void setup_logging(void) {
|
||||||
|
/* We need a dummy function because log_parse_environment is a macro. */
|
||||||
|
log_parse_environment();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setup_logging_once(void) {
|
||||||
|
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||||
|
assert_se(pthread_once(&once, setup_logging) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define NSS_ENTRYPOINT_BEGIN \
|
||||||
|
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK); \
|
||||||
|
setup_logging_once()
|
||||||
|
|
||||||
NSS_GETHOSTBYNAME_PROTOTYPES(mymachines);
|
NSS_GETHOSTBYNAME_PROTOTYPES(mymachines);
|
||||||
NSS_GETPW_PROTOTYPES(mymachines);
|
NSS_GETPW_PROTOTYPES(mymachines);
|
||||||
NSS_GETGR_PROTOTYPES(mymachines);
|
NSS_GETGR_PROTOTYPES(mymachines);
|
||||||
|
@ -94,7 +110,7 @@ enum nss_status _nss_mymachines_gethostbyname4_r(
|
||||||
int n_ifindices, r;
|
int n_ifindices, r;
|
||||||
|
|
||||||
PROTECT_ERRNO;
|
PROTECT_ERRNO;
|
||||||
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
|
NSS_ENTRYPOINT_BEGIN;
|
||||||
|
|
||||||
assert(name);
|
assert(name);
|
||||||
assert(pat);
|
assert(pat);
|
||||||
|
@ -244,7 +260,7 @@ enum nss_status _nss_mymachines_gethostbyname3_r(
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
PROTECT_ERRNO;
|
PROTECT_ERRNO;
|
||||||
BLOCK_SIGNALS(NSS_SIGNALS_BLOCK);
|
NSS_ENTRYPOINT_BEGIN;
|
||||||
|
|
||||||
assert(name);
|
assert(name);
|
||||||
assert(result);
|
assert(result);
|
||||||
|
|
Loading…
Reference in New Issue