summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-01-23 16:32:44 +0100
committerWerner Koch <wk@gnupg.org>2017-01-23 16:33:01 +0100
commitaf5979a42b9468ffe0f3ac6de5a77d982c5cf8a0 (patch)
tree783da2ea7d5f6d964dbb0ed9b233c86e27c70f84
parentdirmngr: On SIGHUP mark all keyservers alive. (diff)
downloadgnupg2-af5979a42b9468ffe0f3ac6de5a77d982c5cf8a0.tar.xz
gnupg2-af5979a42b9468ffe0f3ac6de5a77d982c5cf8a0.zip
Fix format string errors and some missing error case initialization.
* common/logging.c (do_logv): Remove extra parentheses in comparison. * dirmngr/dns-stuff.c (resolve_addr_libdns): Init RES so that dns_res_close is given a defined value in the error case. * dirmngr/http.c (cookie_read, cookie_write) [HTTP_USE_NTBTLS]: Fix format string char. * dirmngr/ks-engine-hkp.c (ks_hkp_help): Remove duplicate "const". * dirmngr/ks-engine-http.c (ks_http_help): Ditto. * dirmngr/ks-engine-kdns.c (ks_kdns_help): Ditto. * dirmngr/ks-engine-ldap.c (ks_ldap_help): Ditto. * scd/app-p15.c (send_keypairinfo, do_getattr): Fix format string char. * tools/gpgconf-comp.c (gpg_agent_runtime_change): Init PID for the error case. (scdaemon_runtime_change): Ditto. (dirmngr_runtime_change): Ditto. * tools/gpgconf.c (query_swdb): Init VALUE_SIZE_UL. Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--common/logging.c2
-rw-r--r--dirmngr/dns-stuff.c2
-rw-r--r--dirmngr/http.c4
-rw-r--r--dirmngr/ks-engine-hkp.c2
-rw-r--r--dirmngr/ks-engine-http.c2
-rw-r--r--dirmngr/ks-engine-kdns.c2
-rw-r--r--dirmngr/ks-engine-ldap.c2
-rw-r--r--scd/app-p15.c4
-rw-r--r--tools/gpgconf-comp.c6
-rw-r--r--tools/gpgconf.c2
10 files changed, 14 insertions, 14 deletions
diff --git a/common/logging.c b/common/logging.c
index 0db1860c1..8c70742cc 100644
--- a/common/logging.c
+++ b/common/logging.c
@@ -798,7 +798,7 @@ do_logv (int level, int ignore_arg_ptr, const char *extrastring,
es_fputs_unlocked ("\\\\", logstream);
else if (c == '\r')
es_fputs_unlocked ("\\r", logstream);
- else if ((c == '\n'))
+ else if (c == '\n')
{
es_fputs_unlocked ("\\n\n", logstream);
if (*extrastring)
diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c
index adeb3925d..9347196b3 100644
--- a/dirmngr/dns-stuff.c
+++ b/dirmngr/dns-stuff.c
@@ -947,7 +947,7 @@ resolve_addr_libdns (const struct sockaddr *addr, int addrlen,
{
gpg_error_t err;
char host[DNS_D_MAXNAME + 1];
- struct dns_resolver *res;
+ struct dns_resolver *res = NULL;
struct dns_packet *ans = NULL;
struct dns_ptr ptr;
int derr;
diff --git a/dirmngr/http.c b/dirmngr/http.c
index 945770742..35877d241 100644
--- a/dirmngr/http.c
+++ b/dirmngr/http.c
@@ -2707,7 +2707,7 @@ cookie_read (void *cookie, void *buffer, size_t size)
ntbtls_get_stream (c->session->tls_session, &in, &out);
nread = es_fread (buffer, 1, size, in);
if (opt_debug)
- log_debug ("TLS network read: %d/%u\n", nread, size);
+ log_debug ("TLS network read: %d/%zu\n", nread, size);
}
else
#elif HTTP_USE_GNUTLS
@@ -2800,7 +2800,7 @@ cookie_write (void *cookie, const void *buffer_arg, size_t size)
else
nwritten = es_fwrite (buffer, 1, size, out);
if (opt_debug)
- log_debug ("TLS network write: %d/%u\n", nwritten, size);
+ log_debug ("TLS network write: %d/%zu\n", nwritten, size);
}
else
#elif HTTP_USE_GNUTLS
diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c
index 9de62674a..45965cecc 100644
--- a/dirmngr/ks-engine-hkp.c
+++ b/dirmngr/ks-engine-hkp.c
@@ -851,7 +851,7 @@ ks_hkp_print_hosttable (ctrl_t ctrl)
gpg_error_t
ks_hkp_help (ctrl_t ctrl, parsed_uri_t uri)
{
- const char const data[] =
+ const char data[] =
"Handler for HKP URLs:\n"
" hkp://\n"
#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS
diff --git a/dirmngr/ks-engine-http.c b/dirmngr/ks-engine-http.c
index 4c4ab1eb8..858c943ea 100644
--- a/dirmngr/ks-engine-http.c
+++ b/dirmngr/ks-engine-http.c
@@ -35,7 +35,7 @@
gpg_error_t
ks_http_help (ctrl_t ctrl, parsed_uri_t uri)
{
- const char const data[] =
+ const char data[] =
"Handler for HTTP URLs:\n"
" http://\n"
#if HTTP_USE_GNUTLS || HTTP_USE_NTBTLS
diff --git a/dirmngr/ks-engine-kdns.c b/dirmngr/ks-engine-kdns.c
index d49d04637..9bb0d420a 100644
--- a/dirmngr/ks-engine-kdns.c
+++ b/dirmngr/ks-engine-kdns.c
@@ -33,7 +33,7 @@
gpg_error_t
ks_kdns_help (ctrl_t ctrl, parsed_uri_t uri)
{
- const char const data[] =
+ const char data[] =
"This keyserver engine accepts URLs of the form:\n"
" kdns://[NAMESERVER]/[ROOT][?at=STRING]\n"
"with\n"
diff --git a/dirmngr/ks-engine-ldap.c b/dirmngr/ks-engine-ldap.c
index ee55bf25d..6d520e98e 100644
--- a/dirmngr/ks-engine-ldap.c
+++ b/dirmngr/ks-engine-ldap.c
@@ -289,7 +289,7 @@ epoch2ldaptime (time_t stamp)
gpg_error_t
ks_ldap_help (ctrl_t ctrl, parsed_uri_t uri)
{
- const char const data[] =
+ const char data[] =
"Handler for LDAP URLs:\n"
" ldap://host:port/[BASEDN]???[bindname=BINDNAME,password=PASSWORD]\n"
"\n"
diff --git a/scd/app-p15.c b/scd/app-p15.c
index 505073e6b..3def55b2e 100644
--- a/scd/app-p15.c
+++ b/scd/app-p15.c
@@ -2463,7 +2463,7 @@ send_keypairinfo (app_t app, ctrl_t ctrl, prkdf_object_t keyinfo)
p = stpcpy (buf, "P15");
if (app->app_local->home_df)
{
- snprintf (p, 6, "-%04hX",
+ snprintf (p, 6, "-%04X",
(unsigned int)(app->app_local->home_df & 0xffff));
p += 5;
}
@@ -2689,7 +2689,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
p = stpcpy (buf, "P15");
if (app->app_local->home_df)
{
- snprintf (p, 6, "-%04hX",
+ snprintf (p, 6, "-%04X",
(unsigned int)(app->app_local->home_df & 0xffff));
p += 5;
}
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index 300f63da6..a25b5136e 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -1138,7 +1138,7 @@ gpg_agent_runtime_change (int killflag)
gpg_error_t err = 0;
const char *pgmname;
const char *argv[5];
- pid_t pid;
+ pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL;
int i = 0;
@@ -1174,7 +1174,7 @@ scdaemon_runtime_change (int killflag)
gpg_error_t err = 0;
const char *pgmname;
const char *argv[9];
- pid_t pid;
+ pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL;
int i = 0;
@@ -1221,7 +1221,7 @@ dirmngr_runtime_change (int killflag)
gpg_error_t err = 0;
const char *pgmname;
const char *argv[6];
- pid_t pid;
+ pid_t pid = (pid_t)(-1);
char *abs_homedir = NULL;
pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
diff --git a/tools/gpgconf.c b/tools/gpgconf.c
index c69b1c3e2..a5ee188ec 100644
--- a/tools/gpgconf.c
+++ b/tools/gpgconf.c
@@ -280,7 +280,7 @@ query_swdb (estream_t out, const char *name, const char *current_version)
gnupg_isotime_t value_date = {0};
char *value_size = NULL;
char *value_sha2 = NULL;
- unsigned long value_size_ul;
+ unsigned long value_size_ul = 0;
int status, i;