mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-14 00:19:50 +02:00
Add a hook to be called right after main.
* common/init.c (early_system_init): New stub function. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
b1d5ed6ac8
commit
0c2bfd9d5a
|
@ -665,6 +665,8 @@ main (int argc, char **argv )
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
struct assuan_malloc_hooks malloc_hooks;
|
struct assuan_malloc_hooks malloc_hooks;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
|
|
||||||
/* Before we do anything else we save the list of currently open
|
/* Before we do anything else we save the list of currently open
|
||||||
file descriptors and the signal mask. This info is required to
|
file descriptors and the signal mask. This info is required to
|
||||||
do the exec call properly. */
|
do the exec call properly. */
|
||||||
|
|
|
@ -212,6 +212,7 @@ main (int argc, char **argv)
|
||||||
int cmd = 0;
|
int cmd = 0;
|
||||||
const char *keygrip = NULL;
|
const char *keygrip = NULL;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("gpg-preset-passphrase", 1);
|
log_set_prefix ("gpg-preset-passphrase", 1);
|
||||||
|
|
||||||
|
|
|
@ -549,6 +549,7 @@ main (int argc, char **argv )
|
||||||
int cmd = 0;
|
int cmd = 0;
|
||||||
const char *fname;
|
const char *fname;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||||
log_set_prefix ("gpg-protect-tool", 1);
|
log_set_prefix ("gpg-protect-tool", 1);
|
||||||
|
|
|
@ -133,6 +133,13 @@ writestring_via_estream (int mode, const char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This function should be the first called after main. */
|
||||||
|
void
|
||||||
|
early_system_init (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This function is to be used early at program startup to make sure
|
/* This function is to be used early at program startup to make sure
|
||||||
that some subsystems are initialized. This is in particular
|
that some subsystems are initialized. This is in particular
|
||||||
important for W32 to initialize the sockets so that our socket
|
important for W32 to initialize the sockets so that our socket
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
void register_mem_cleanup_func (void (*func)(void));
|
void register_mem_cleanup_func (void (*func)(void));
|
||||||
|
|
||||||
|
void early_system_init (void);
|
||||||
void _init_common_subsystems (gpg_err_source_t errsource,
|
void _init_common_subsystems (gpg_err_source_t errsource,
|
||||||
int *argcp, char ***argvp);
|
int *argcp, char ***argvp);
|
||||||
#define init_common_subsystems(a,b) \
|
#define init_common_subsystems(a,b) \
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
|
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "init.h"
|
||||||
|
|
||||||
|
|
||||||
/* Constants for the options. */
|
/* Constants for the options. */
|
||||||
|
@ -180,6 +181,7 @@ main (int argc, char **argv )
|
||||||
int cmd_loadcrl = 0;
|
int cmd_loadcrl = 0;
|
||||||
int cmd_squid_mode = 0;
|
int cmd_squid_mode = 0;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("dirmngr-client",
|
log_set_prefix ("dirmngr-client",
|
||||||
JNLIB_LOG_WITH_PREFIX);
|
JNLIB_LOG_WITH_PREFIX);
|
||||||
|
|
|
@ -650,6 +650,8 @@ main (int argc, char **argv)
|
||||||
int homedir_seen = 0;
|
int homedir_seen = 0;
|
||||||
struct assuan_malloc_hooks malloc_hooks;
|
struct assuan_malloc_hooks malloc_hooks;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
|
|
||||||
#ifdef USE_W32_SERVICE
|
#ifdef USE_W32_SERVICE
|
||||||
/* The option will be set by main() below if we should run as a
|
/* The option will be set by main() below if we should run as a
|
||||||
system daemon. */
|
system daemon. */
|
||||||
|
|
|
@ -242,6 +242,8 @@ ldap_wrapper_main (char **argv, estream_t outstream)
|
||||||
|
|
||||||
memset (&my_opt_buffer, 0, sizeof my_opt_buffer);
|
memset (&my_opt_buffer, 0, sizeof my_opt_buffer);
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
|
|
||||||
#ifdef USE_LDAPWRAPPER
|
#ifdef USE_LDAPWRAPPER
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("dirmngr_ldap", JNLIB_LOG_WITH_PREFIX);
|
log_set_prefix ("dirmngr_ldap", JNLIB_LOG_WITH_PREFIX);
|
||||||
|
|
|
@ -2048,6 +2048,7 @@ main (int argc, char **argv)
|
||||||
/* Please note that we may running SUID(ROOT), so be very CAREFUL
|
/* Please note that we may running SUID(ROOT), so be very CAREFUL
|
||||||
when adding any stuff between here and the call to
|
when adding any stuff between here and the call to
|
||||||
secmem_init() somewhere after the option parsing. */
|
secmem_init() somewhere after the option parsing. */
|
||||||
|
early_system_init ();
|
||||||
gnupg_reopen_std (GPG_NAME);
|
gnupg_reopen_std (GPG_NAME);
|
||||||
trap_unaligned ();
|
trap_unaligned ();
|
||||||
gnupg_rl_initialize ();
|
gnupg_rl_initialize ();
|
||||||
|
|
|
@ -144,6 +144,7 @@ main( int argc, char **argv )
|
||||||
unsigned configlineno;
|
unsigned configlineno;
|
||||||
ctrl_t ctrl;
|
ctrl_t ctrl;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("gpgv", 1);
|
log_set_prefix ("gpgv", 1);
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,7 @@ main ( int argc, char **argv)
|
||||||
|
|
||||||
/*mtrace();*/
|
/*mtrace();*/
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
gnupg_reopen_std (G13_NAME);
|
gnupg_reopen_std (G13_NAME);
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||||
|
|
|
@ -452,6 +452,7 @@ main( int argc, char **argv )
|
||||||
unsigned long from = 0, to = ULONG_MAX;
|
unsigned long from = 0, to = ULONG_MAX;
|
||||||
int dry_run = 0;
|
int dry_run = 0;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage( my_strusage );
|
set_strusage( my_strusage );
|
||||||
gcry_control (GCRYCTL_DISABLE_SECMEM);
|
gcry_control (GCRYCTL_DISABLE_SECMEM);
|
||||||
log_set_prefix ("kbxutil", 1);
|
log_set_prefix ("kbxutil", 1);
|
||||||
|
|
|
@ -411,6 +411,7 @@ main (int argc, char **argv )
|
||||||
int res;
|
int res;
|
||||||
npth_t pipecon_handler;
|
npth_t pipecon_handler;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||||
/* Please note that we may running SUID(ROOT), so be very CAREFUL
|
/* Please note that we may running SUID(ROOT), so be very CAREFUL
|
||||||
|
|
|
@ -910,6 +910,7 @@ main ( int argc, char **argv)
|
||||||
|
|
||||||
/*mtrace();*/
|
/*mtrace();*/
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
gnupg_reopen_std (GPGSM_NAME);
|
gnupg_reopen_std (GPGSM_NAME);
|
||||||
/* trap_unaligned ();*/
|
/* trap_unaligned ();*/
|
||||||
gnupg_rl_initialize ();
|
gnupg_rl_initialize ();
|
||||||
|
|
|
@ -164,6 +164,7 @@ main (int argc, char **argv )
|
||||||
size_t raw_pattern_length;
|
size_t raw_pattern_length;
|
||||||
pattern_t *patternarray;
|
pattern_t *patternarray;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
|
||||||
log_set_prefix ("gpg-check-pattern", 1);
|
log_set_prefix ("gpg-check-pattern", 1);
|
||||||
|
|
|
@ -1169,6 +1169,7 @@ main (int argc, char **argv)
|
||||||
int loopidx;
|
int loopidx;
|
||||||
char **cmdline_commands = NULL;
|
char **cmdline_commands = NULL;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
gnupg_rl_initialize ();
|
gnupg_rl_initialize ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("gpg-connect-agent", 1);
|
log_set_prefix ("gpg-connect-agent", 1);
|
||||||
|
|
|
@ -151,6 +151,7 @@ main (int argc, char **argv)
|
||||||
enum cmd_and_opt_values cmd = 0;
|
enum cmd_and_opt_values cmd = 0;
|
||||||
estream_t outfp = NULL;
|
estream_t outfp = NULL;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
gnupg_reopen_std (GPGCONF_NAME);
|
gnupg_reopen_std (GPGCONF_NAME);
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix (GPGCONF_NAME, 1);
|
log_set_prefix (GPGCONF_NAME, 1);
|
||||||
|
|
|
@ -889,6 +889,7 @@ main (int argc, char **argv)
|
||||||
char *logfile = NULL;
|
char *logfile = NULL;
|
||||||
int default_config = 1;
|
int default_config = 1;
|
||||||
|
|
||||||
|
early_system_init ();
|
||||||
set_strusage (my_strusage);
|
set_strusage (my_strusage);
|
||||||
log_set_prefix ("symcryptrun", 1);
|
log_set_prefix ("symcryptrun", 1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user