1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01: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:
Werner Koch 2015-01-28 19:57:22 +01:00
parent b1d5ed6ac8
commit 0c2bfd9d5a
18 changed files with 28 additions and 0 deletions

View File

@ -665,6 +665,8 @@ main (int argc, char **argv )
gpg_error_t err;
struct assuan_malloc_hooks malloc_hooks;
early_system_init ();
/* Before we do anything else we save the list of currently open
file descriptors and the signal mask. This info is required to
do the exec call properly. */

View File

@ -212,6 +212,7 @@ main (int argc, char **argv)
int cmd = 0;
const char *keygrip = NULL;
early_system_init ();
set_strusage (my_strusage);
log_set_prefix ("gpg-preset-passphrase", 1);

View File

@ -549,6 +549,7 @@ main (int argc, char **argv )
int cmd = 0;
const char *fname;
early_system_init ();
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
log_set_prefix ("gpg-protect-tool", 1);

View File

@ -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
that some subsystems are initialized. This is in particular
important for W32 to initialize the sockets so that our socket

View File

@ -38,6 +38,7 @@
void register_mem_cleanup_func (void (*func)(void));
void early_system_init (void);
void _init_common_subsystems (gpg_err_source_t errsource,
int *argcp, char ***argvp);
#define init_common_subsystems(a,b) \

View File

@ -40,6 +40,7 @@
#include "i18n.h"
#include "util.h"
#include "init.h"
/* Constants for the options. */
@ -180,6 +181,7 @@ main (int argc, char **argv )
int cmd_loadcrl = 0;
int cmd_squid_mode = 0;
early_system_init ();
set_strusage (my_strusage);
log_set_prefix ("dirmngr-client",
JNLIB_LOG_WITH_PREFIX);

View File

@ -650,6 +650,8 @@ main (int argc, char **argv)
int homedir_seen = 0;
struct assuan_malloc_hooks malloc_hooks;
early_system_init ();
#ifdef USE_W32_SERVICE
/* The option will be set by main() below if we should run as a
system daemon. */

View File

@ -242,6 +242,8 @@ ldap_wrapper_main (char **argv, estream_t outstream)
memset (&my_opt_buffer, 0, sizeof my_opt_buffer);
early_system_init ();
#ifdef USE_LDAPWRAPPER
set_strusage (my_strusage);
log_set_prefix ("dirmngr_ldap", JNLIB_LOG_WITH_PREFIX);

View File

@ -2048,6 +2048,7 @@ main (int argc, char **argv)
/* Please note that we may running SUID(ROOT), so be very CAREFUL
when adding any stuff between here and the call to
secmem_init() somewhere after the option parsing. */
early_system_init ();
gnupg_reopen_std (GPG_NAME);
trap_unaligned ();
gnupg_rl_initialize ();

View File

@ -144,6 +144,7 @@ main( int argc, char **argv )
unsigned configlineno;
ctrl_t ctrl;
early_system_init ();
set_strusage (my_strusage);
log_set_prefix ("gpgv", 1);

View File

@ -344,6 +344,7 @@ main ( int argc, char **argv)
/*mtrace();*/
early_system_init ();
gnupg_reopen_std (G13_NAME);
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);

View File

@ -452,6 +452,7 @@ main( int argc, char **argv )
unsigned long from = 0, to = ULONG_MAX;
int dry_run = 0;
early_system_init ();
set_strusage( my_strusage );
gcry_control (GCRYCTL_DISABLE_SECMEM);
log_set_prefix ("kbxutil", 1);

View File

@ -411,6 +411,7 @@ main (int argc, char **argv )
int res;
npth_t pipecon_handler;
early_system_init ();
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
/* Please note that we may running SUID(ROOT), so be very CAREFUL

View File

@ -910,6 +910,7 @@ main ( int argc, char **argv)
/*mtrace();*/
early_system_init ();
gnupg_reopen_std (GPGSM_NAME);
/* trap_unaligned ();*/
gnupg_rl_initialize ();

View File

@ -164,6 +164,7 @@ main (int argc, char **argv )
size_t raw_pattern_length;
pattern_t *patternarray;
early_system_init ();
set_strusage (my_strusage);
gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
log_set_prefix ("gpg-check-pattern", 1);

View File

@ -1169,6 +1169,7 @@ main (int argc, char **argv)
int loopidx;
char **cmdline_commands = NULL;
early_system_init ();
gnupg_rl_initialize ();
set_strusage (my_strusage);
log_set_prefix ("gpg-connect-agent", 1);

View File

@ -151,6 +151,7 @@ main (int argc, char **argv)
enum cmd_and_opt_values cmd = 0;
estream_t outfp = NULL;
early_system_init ();
gnupg_reopen_std (GPGCONF_NAME);
set_strusage (my_strusage);
log_set_prefix (GPGCONF_NAME, 1);

View File

@ -889,6 +889,7 @@ main (int argc, char **argv)
char *logfile = NULL;
int default_config = 1;
early_system_init ();
set_strusage (my_strusage);
log_set_prefix ("symcryptrun", 1);