[PATCH v3 1/5] logging: Call log_set_prefix() with human-readable labels.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Aug 12 07:37:57 CEST 2016


* agent/preset-passphrase.c, agent/protect-tool.c, dirmngr/dirmngr.c,
  dirmngr/t-http.c, g10/gpg.c, g10/gpgv.c, g13/g13-syshelp.c,
  g13/g13.c, kbx/kbxutil.c, scd/scdaemon.c, sm/gpgsm.c,
  tests/gpgscm/main.c, tools/gpg-check-pattern.c,
  tools/gpg-connect-agent.c, tools/gpgconf.c, tools/gpgtar.c,
  tools/symcryptrun.c (main): invoke log_set_prefix() with
  human-readable labels.

--

Some invocations of log_set_prefix() were done with raw numeric values
instead of values that humans can understand.  Use symbolic
representations instead of numeric for better readability.

Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 agent/preset-passphrase.c | 2 +-
 agent/protect-tool.c      | 2 +-
 dirmngr/dirmngr.c         | 4 ++--
 dirmngr/t-http.c          | 2 +-
 g10/gpg.c                 | 4 ++--
 g10/gpgv.c                | 2 +-
 g13/g13-syshelp.c         | 4 ++--
 g13/g13.c                 | 4 ++--
 kbx/kbxutil.c             | 2 +-
 scd/scdaemon.c            | 4 ++--
 sm/gpgsm.c                | 4 ++--
 tests/gpgscm/main.c       | 2 +-
 tools/gpg-check-pattern.c | 2 +-
 tools/gpg-connect-agent.c | 2 +-
 tools/gpgconf.c           | 2 +-
 tools/gpgtar.c            | 2 +-
 tools/symcryptrun.c       | 2 +-
 17 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/agent/preset-passphrase.c b/agent/preset-passphrase.c
index 485ca7b..a104977 100644
--- a/agent/preset-passphrase.c
+++ b/agent/preset-passphrase.c
@@ -208,7 +208,7 @@ main (int argc, char **argv)
 
   early_system_init ();
   set_strusage (my_strusage);
-  log_set_prefix ("gpg-preset-passphrase", 1);
+  log_set_prefix ("gpg-preset-passphrase", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
diff --git a/agent/protect-tool.c b/agent/protect-tool.c
index f41cc0b..dbf7811 100644
--- a/agent/protect-tool.c
+++ b/agent/protect-tool.c
@@ -560,7 +560,7 @@ main (int argc, char **argv )
   early_system_init ();
   set_strusage (my_strusage);
   gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
-  log_set_prefix ("gpg-protect-tool", 1);
+  log_set_prefix ("gpg-protect-tool", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 007fa10..cb17420 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -743,7 +743,7 @@ main (int argc, char **argv)
 #endif /*USE_W32_SERVICE*/
 
   set_strusage (my_strusage);
-  log_set_prefix (DIRMNGR_NAME, 1|4);
+  log_set_prefix (DIRMNGR_NAME, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_PID);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
@@ -1073,7 +1073,7 @@ main (int argc, char **argv)
       if (logfile)
         {
           log_set_file (logfile);
-          log_set_prefix (NULL, 2|4);
+          log_set_prefix (NULL, GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
         }
 
       if (debug_wait)
diff --git a/dirmngr/t-http.c b/dirmngr/t-http.c
index 3a6be6c..59959c4 100644
--- a/dirmngr/t-http.c
+++ b/dirmngr/t-http.c
@@ -154,7 +154,7 @@ main (int argc, char **argv)
   http_session_t session = NULL;
 
   gpgrt_init ();
-  log_set_prefix (PGM, 1 | 4);
+  log_set_prefix (PGM, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_PID);
   if (argc)
     { argc--; argv++; }
   while (argc && last_argc != argc )
diff --git a/g10/gpg.c b/g10/gpg.c
index fd21fde..891c85f 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -2171,7 +2171,7 @@ main (int argc, char **argv)
     gnupg_rl_initialize ();
     set_strusage (my_strusage);
     gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
-    log_set_prefix (GPG_NAME, 1);
+    log_set_prefix (GPG_NAME, GPGRT_LOG_WITH_PREFIX);
 
     /* Make sure that our subsystems are ready.  */
     i18n_init();
@@ -3429,7 +3429,7 @@ main (int argc, char **argv)
     if (logfile && opt.batch)
       {
         log_set_file (logfile);
-        log_set_prefix (NULL, 1|2|4);
+        log_set_prefix (NULL, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
       }
 
     if (opt.verbose > 2)
diff --git a/g10/gpgv.c b/g10/gpgv.c
index fd1090e..4ef3e8b 100644
--- a/g10/gpgv.c
+++ b/g10/gpgv.c
@@ -149,7 +149,7 @@ main( int argc, char **argv )
 
   early_system_init ();
   set_strusage (my_strusage);
-  log_set_prefix ("gpgv", 1);
+  log_set_prefix ("gpgv", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init();
diff --git a/g13/g13-syshelp.c b/g13/g13-syshelp.c
index 0bb34da..7976be4 100644
--- a/g13/g13-syshelp.c
+++ b/g13/g13-syshelp.c
@@ -244,7 +244,7 @@ main ( int argc, char **argv)
   set_strusage (my_strusage);
   gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
 
-  log_set_prefix (G13_NAME "-syshelp", 1);
+  log_set_prefix (G13_NAME "-syshelp", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
@@ -437,7 +437,7 @@ main ( int argc, char **argv)
   if (logfile)
     {
       log_set_file (logfile);
-      log_set_prefix (NULL, 1|2|4);
+      log_set_prefix (NULL, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
     }
 
   if (gnupg_faked_time_p ())
diff --git a/g13/g13.c b/g13/g13.c
index 082edc9..7c6e2e3 100644
--- a/g13/g13.c
+++ b/g13/g13.c
@@ -364,7 +364,7 @@ main ( int argc, char **argv)
   set_strusage (my_strusage);
   gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
 
-  log_set_prefix (G13_NAME, 1);
+  log_set_prefix (G13_NAME, GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
@@ -655,7 +655,7 @@ main ( int argc, char **argv)
   if (logfile)
     {
       log_set_file (logfile);
-      log_set_prefix (NULL, 1|2|4);
+      log_set_prefix (NULL, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
     }
 
   if (gnupg_faked_time_p ())
diff --git a/kbx/kbxutil.c b/kbx/kbxutil.c
index e452b4d..77b134a 100644
--- a/kbx/kbxutil.c
+++ b/kbx/kbxutil.c
@@ -454,7 +454,7 @@ main( int argc, char **argv )
   early_system_init ();
   set_strusage( my_strusage );
   gcry_control (GCRYCTL_DISABLE_SECMEM);
-  log_set_prefix ("kbxutil", 1);
+  log_set_prefix ("kbxutil", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index 263d9bd..514e3c2 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -416,7 +416,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 INIT_SECMEM()
      somewhere after the option parsing */
-  log_set_prefix ("scdaemon", 1|4);
+  log_set_prefix ("scdaemon", GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_PID);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
@@ -695,7 +695,7 @@ main (int argc, char **argv )
   if (logfile)
     {
       log_set_file (logfile);
-      log_set_prefix (NULL, 1|2|4);
+      log_set_prefix (NULL, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
     }
 
   if (debug_wait && pipe_server)
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 42b6706..e3b1e88 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -930,7 +930,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 */
-  log_set_prefix (GPGSM_NAME, 1);
+  log_set_prefix (GPGSM_NAME, GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
@@ -1507,7 +1507,7 @@ main ( int argc, char **argv)
   if (logfile && cmd == aServer)
     {
       log_set_file (logfile);
-      log_set_prefix (NULL, 1|2|4);
+      log_set_prefix (NULL, GPGRT_LOG_WITH_PREFIX | GPGRT_LOG_WITH_TIME | GPGRT_LOG_WITH_PID);
     }
 
   if (gnupg_faked_time_p ())
diff --git a/tests/gpgscm/main.c b/tests/gpgscm/main.c
index 5b3792e..34ebb9f 100644
--- a/tests/gpgscm/main.c
+++ b/tests/gpgscm/main.c
@@ -216,7 +216,7 @@ main (int argc, char **argv)
       *p = 0, scmpath_len++;
 
   set_strusage (my_strusage);
-  log_set_prefix ("gpgscm", 1);
+  log_set_prefix ("gpgscm", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
diff --git a/tools/gpg-check-pattern.c b/tools/gpg-check-pattern.c
index aa228a7..fba2365 100644
--- a/tools/gpg-check-pattern.c
+++ b/tools/gpg-check-pattern.c
@@ -165,7 +165,7 @@ main (int argc, char **argv )
   early_system_init ();
   set_strusage (my_strusage);
   gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN);
-  log_set_prefix ("gpg-check-pattern", 1);
+  log_set_prefix ("gpg-check-pattern", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init ();
diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c
index 6b5f507..106a8eb 100644
--- a/tools/gpg-connect-agent.c
+++ b/tools/gpg-connect-agent.c
@@ -1172,7 +1172,7 @@ main (int argc, char **argv)
   early_system_init ();
   gnupg_rl_initialize ();
   set_strusage (my_strusage);
-  log_set_prefix ("gpg-connect-agent", 1);
+  log_set_prefix ("gpg-connect-agent", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init();
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index f7ce4c9..69ea9c9 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -223,7 +223,7 @@ main (int argc, char **argv)
   early_system_init ();
   gnupg_reopen_std (GPGCONF_NAME);
   set_strusage (my_strusage);
-  log_set_prefix (GPGCONF_NAME, 1);
+  log_set_prefix (GPGCONF_NAME, GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init();
diff --git a/tools/gpgtar.c b/tools/gpgtar.c
index fcbee50..9c17139 100644
--- a/tools/gpgtar.c
+++ b/tools/gpgtar.c
@@ -416,7 +416,7 @@ main (int argc, char **argv)
 
   gnupg_reopen_std (GPGTAR_NAME);
   set_strusage (my_strusage);
-  log_set_prefix (GPGTAR_NAME, 1);
+  log_set_prefix (GPGTAR_NAME, GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init();
diff --git a/tools/symcryptrun.c b/tools/symcryptrun.c
index b6dc843..b2d8f5c 100644
--- a/tools/symcryptrun.c
+++ b/tools/symcryptrun.c
@@ -886,7 +886,7 @@ main (int argc, char **argv)
 
   early_system_init ();
   set_strusage (my_strusage);
-  log_set_prefix ("symcryptrun", 1);
+  log_set_prefix ("symcryptrun", GPGRT_LOG_WITH_PREFIX);
 
   /* Make sure that our subsystems are ready.  */
   i18n_init();
-- 
2.8.1




More information about the Gnupg-devel mailing list