1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00

sm: Avoid warnings about useless assignments.

* sm/call-dirmngr.c (prepare_dirmngr): Remove setting of ERR.
(unhexify_fpr): Remove useless computation on N.
* sm/certchain.c (do_validate_chain): Remove clearing of RC.  Remove
useless setting of RC.
* sm/fingerprint.c (gpgsm_get_keygrip): Remove setting of RC.
* sm/gpgsm.c (build_list): Replace final stpcpy by strcpy.
* sm/keydb.c (keydb_clear_some_cert_flags): Remove clearing of RC.
* sm/server.c (cmd_getauditlog): Comment unused skip_options.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-06 17:51:58 +01:00
parent 0de7d61437
commit 126aebbb82
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
6 changed files with 15 additions and 19 deletions

View File

@ -181,9 +181,11 @@ prepare_dirmngr (ctrl_t ctrl, assuan_context_t ctx, gpg_error_t err)
server->host, server->port, user, pass, base); server->host, server->port, user, pass, base);
line[DIM (line) - 1] = 0; line[DIM (line) - 1] = 0;
err = assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL); assuan_transact (ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (gpg_err_code (err) == GPG_ERR_ASS_UNKNOWN_CMD) /* The code below is not required becuase we don't return an error. */
err = 0; /* Allow the use of old dirmngr versions. */ /* err = [above call] */
/* if (gpg_err_code (err) == GPG_ERR_ASS_UNKNOWN_CMD) */
/* err = 0; /\* Allow the use of old dirmngr versions. *\/ */
server = server->next; server = server->next;
} }
@ -402,7 +404,6 @@ unhexify_fpr (const char *hexstr, unsigned char *fpr)
; ;
if (*s || (n != 40)) if (*s || (n != 40))
return 0; /* no fingerprint (invalid or wrong length). */ return 0; /* no fingerprint (invalid or wrong length). */
n /= 2;
for (s=hexstr, n=0; *s; s += 2, n++) for (s=hexstr, n=0; *s; s += 2, n++)
fpr[n] = xtoi_2 (s); fpr[n] = xtoi_2 (s);
return 1; /* okay */ return 1; /* okay */

View File

@ -405,7 +405,9 @@ check_cert_policy (ksba_cert_t cert, int listmode, estream_t fplist)
} }
while (!*p || *p == '\n' || *p == '#'); while (!*p || *p == '\n' || *p == '#');
/* parse line */ /* Parse line. Note that the line has always a LF and spacep
does not consider a LF a space. Thus strpbrk will always
succeed. */
for (allowed=line; spacep (allowed); allowed++) for (allowed=line; spacep (allowed); allowed++)
; ;
p = strpbrk (allowed, " :\n"); p = strpbrk (allowed, " :\n");
@ -1389,10 +1391,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg,
exptime, listmode, listfp, exptime, listmode, listfp,
(depth && is_root)? -1: depth); (depth && is_root)? -1: depth);
if (gpg_err_code (rc) == GPG_ERR_CERT_EXPIRED) if (gpg_err_code (rc) == GPG_ERR_CERT_EXPIRED)
{
any_expired = 1; any_expired = 1;
rc = 0;
}
else if (rc) else if (rc)
goto leave; goto leave;
@ -1409,7 +1408,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg,
if (gpg_err_code (rc) == GPG_ERR_NO_POLICY_MATCH) if (gpg_err_code (rc) == GPG_ERR_NO_POLICY_MATCH)
{ {
any_no_policy_match = 1; any_no_policy_match = 1;
rc = 1; rc = 1; /* Be on the safe side and set RC. */
} }
else if (rc) else if (rc)
goto leave; goto leave;
@ -1612,7 +1611,8 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg,
/* The find next did not work or returned an /* The find next did not work or returned an
identical certificate. We better stop here identical certificate. We better stop here
to avoid infinite checks. */ to avoid infinite checks. */
rc = gpg_error (GPG_ERR_BAD_SIGNATURE); /* No need to set RC because it is not used:
rc = gpg_error (GPG_ERR_BAD_SIGNATURE); */
ksba_cert_release (tmp_cert); ksba_cert_release (tmp_cert);
} }
else else

View File

@ -192,7 +192,6 @@ gpgsm_get_keygrip (ksba_cert_t cert, unsigned char *array)
gcry_sexp_release (s_pkey); gcry_sexp_release (s_pkey);
if (!array) if (!array)
{ {
rc = gpg_error (GPG_ERR_GENERAL);
log_error ("can't calculate keygrip\n"); log_error ("can't calculate keygrip\n");
return NULL; return NULL;
} }

View File

@ -630,7 +630,7 @@ build_list (const char *text, const char * (*mapf)(int), int (*chkf)(int))
} }
} }
if (p) if (p)
p = stpcpy(p, "\n" ); strcpy (p, "\n" );
return list; return list;
} }

View File

@ -1291,11 +1291,7 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names)
{ {
rc = classify_user_id (sl->d, desc+ndesc, 0); rc = classify_user_id (sl->d, desc+ndesc, 0);
if (rc) if (rc)
{ log_error ("key '%s' not found: %s\n", sl->d, gpg_strerror (rc));
log_error ("key '%s' not found: %s\n",
sl->d, gpg_strerror (rc));
rc = 0;
}
else else
ndesc++; ndesc++;
} }

View File

@ -1083,7 +1083,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
opt_data = has_option (line, "--data"); opt_data = has_option (line, "--data");
opt_html = has_option (line, "--html"); opt_html = has_option (line, "--html");
line = skip_options (line); /* Not needed: line = skip_options (line); */
if (!ctrl->audit) if (!ctrl->audit)
return gpg_error (GPG_ERR_NO_DATA); return gpg_error (GPG_ERR_NO_DATA);