mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Fixed set but unused variable bugs
This commit is contained in:
parent
14442d2be0
commit
816bee1fa0
@ -1,3 +1,11 @@
|
||||
2011-08-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* genkey.c (check_passphrase_pattern): Use gpg_strerror instead of
|
||||
strerror.
|
||||
* command-ssh.c (ssh_receive_mpint_list): Remove unused var
|
||||
ELEMS_PUBLIC_N.
|
||||
* gpg-agent.c (main): Remove unused var MAY_COREDUMP.
|
||||
|
||||
2011-08-09 Ben Kibbey <bjk@luxsci.net>
|
||||
|
||||
* command.c (option_handler): Have option s2k-count match the
|
||||
|
@ -933,7 +933,6 @@ static gpg_error_t
|
||||
ssh_receive_mpint_list (estream_t stream, int secret,
|
||||
ssh_key_type_spec_t key_spec, gcry_mpi_t **mpi_list)
|
||||
{
|
||||
unsigned int elems_public_n;
|
||||
const char *elems_public;
|
||||
unsigned int elems_n;
|
||||
const char *elems;
|
||||
@ -952,7 +951,6 @@ ssh_receive_mpint_list (estream_t stream, int secret,
|
||||
elems_n = strlen (elems);
|
||||
|
||||
elems_public = key_spec.elems_key_public;
|
||||
elems_public_n = strlen (elems_public);
|
||||
|
||||
mpis = xtrycalloc (elems_n + 1, sizeof *mpis );
|
||||
if (!mpis)
|
||||
|
@ -106,7 +106,7 @@ check_passphrase_pattern (ctrl_t ctrl, const char *pw)
|
||||
if (!infp)
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating temporary file: %s\n"), strerror (errno));
|
||||
log_error (_("error creating temporary file: %s\n"), gpg_strerror (err));
|
||||
return 1; /* Error - assume password should not be used. */
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ check_passphrase_pattern (ctrl_t ctrl, const char *pw)
|
||||
{
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error writing to temporary file: %s\n"),
|
||||
strerror (errno));
|
||||
gpg_strerror (err));
|
||||
fclose (infp);
|
||||
return 1; /* Error - assume password should not be used. */
|
||||
}
|
||||
|
@ -568,7 +568,6 @@ main (int argc, char **argv )
|
||||
{
|
||||
ARGPARSE_ARGS pargs;
|
||||
int orig_argc;
|
||||
int may_coredump;
|
||||
char **orig_argv;
|
||||
FILE *configfp = NULL;
|
||||
char *configname = NULL;
|
||||
@ -642,7 +641,7 @@ main (int argc, char **argv )
|
||||
setup_libgcrypt_logging ();
|
||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||
|
||||
may_coredump = disable_core_dumps ();
|
||||
disable_core_dumps ();
|
||||
|
||||
/* Set default options. */
|
||||
parse_rereadable_options (NULL, 0); /* Reset them to default values. */
|
||||
|
@ -1,3 +1,13 @@
|
||||
2011-08-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* t-exechelp.c (test_close_all_fds): Don't use the DUMMY_FD var.
|
||||
|
||||
* pka.c (get_pka_info): Remove unused var.
|
||||
|
||||
* signal.c (got_fatal_signal): Remove unused var.
|
||||
|
||||
* estream.c (es_fread, es_fwrite): Remove unused var.
|
||||
|
||||
2011-07-20 Werner Koch <wk@g10code.com>
|
||||
|
||||
* ssh-utils.c, ssh-utils.h: New.
|
||||
|
@ -3425,12 +3425,11 @@ es_fread (void *ES__RESTRICT ptr, size_t size, size_t nitems,
|
||||
estream_t ES__RESTRICT stream)
|
||||
{
|
||||
size_t ret, bytes;
|
||||
int err;
|
||||
|
||||
if (size * nitems)
|
||||
{
|
||||
ESTREAM_LOCK (stream);
|
||||
err = es_readn (stream, ptr, size * nitems, &bytes);
|
||||
es_readn (stream, ptr, size * nitems, &bytes);
|
||||
ESTREAM_UNLOCK (stream);
|
||||
|
||||
ret = bytes / size;
|
||||
@ -3447,12 +3446,11 @@ es_fwrite (const void *ES__RESTRICT ptr, size_t size, size_t nitems,
|
||||
estream_t ES__RESTRICT stream)
|
||||
{
|
||||
size_t ret, bytes;
|
||||
int err;
|
||||
|
||||
if (size * nitems)
|
||||
{
|
||||
ESTREAM_LOCK (stream);
|
||||
err = es_writen (stream, ptr, size * nitems, &bytes);
|
||||
es_writen (stream, ptr, size * nitems, &bytes);
|
||||
ESTREAM_UNLOCK (stream);
|
||||
|
||||
ret = bytes / size;
|
||||
|
@ -175,7 +175,7 @@ get_pka_info (const char *address, unsigned char *fpr)
|
||||
#else /*!USE_ADNS*/
|
||||
unsigned char answer[PACKETSZ];
|
||||
int anslen;
|
||||
int qdcount, ancount, nscount, arcount;
|
||||
int qdcount, ancount;
|
||||
int rc;
|
||||
unsigned char *p, *pend;
|
||||
const char *domain;
|
||||
@ -212,8 +212,6 @@ get_pka_info (const char *address, unsigned char *fpr)
|
||||
|
||||
qdcount = ntohs (header.qdcount);
|
||||
ancount = ntohs (header.ancount);
|
||||
nscount = ntohs (header.nscount);
|
||||
arcount = ntohs (header.arcount);
|
||||
|
||||
if (!ancount)
|
||||
return NULL; /* Got no answer. */
|
||||
|
@ -89,8 +89,6 @@ get_signal_name( int signum )
|
||||
static RETSIGTYPE
|
||||
got_fatal_signal (int sig)
|
||||
{
|
||||
/* Dummy result variable to suppress gcc warning. */
|
||||
int res;
|
||||
const char *s;
|
||||
|
||||
if (caught_fatal_sig)
|
||||
@ -100,14 +98,14 @@ got_fatal_signal (int sig)
|
||||
if (cleanup_fnc)
|
||||
cleanup_fnc ();
|
||||
/* Better don't translate these messages. */
|
||||
res = write (2, "\n", 1 );
|
||||
(void)write (2, "\n", 1 );
|
||||
s = log_get_prefix (NULL);
|
||||
if (s)
|
||||
res = write(2, s, strlen (s));
|
||||
res = write (2, ": signal ", 9 );
|
||||
(void)write(2, s, strlen (s));
|
||||
(void)write (2, ": signal ", 9 );
|
||||
s = get_signal_name(sig);
|
||||
if (s)
|
||||
res = write (2, s, strlen(s) );
|
||||
(void) write (2, s, strlen(s) );
|
||||
else
|
||||
{
|
||||
/* We are in a signal handler so we can't use any kind of printf
|
||||
@ -117,7 +115,7 @@ got_fatal_signal (int sig)
|
||||
things are messed up because we modify its value. Although
|
||||
this is a bug in that system, we will protect against it. */
|
||||
if (sig < 0 || sig >= 100000)
|
||||
res = write (2, "?", 1);
|
||||
(void)write (2, "?", 1);
|
||||
else
|
||||
{
|
||||
int i, value, any=0;
|
||||
@ -126,7 +124,7 @@ got_fatal_signal (int sig)
|
||||
{
|
||||
if (value >= i || ((any || i==1) && !(value/i)))
|
||||
{
|
||||
res = write (2, "0123456789"+(value/i), 1);
|
||||
(void)write (2, "0123456789"+(value/i), 1);
|
||||
if ((value/i))
|
||||
any = 1;
|
||||
value %= i;
|
||||
@ -134,7 +132,7 @@ got_fatal_signal (int sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
res = write (2, " caught ... exiting\n", 20);
|
||||
(void)write (2, " caught ... exiting\n", 20);
|
||||
|
||||
/* Reset action to default action and raise signal again */
|
||||
init_one_signal (sig, SIG_DFL, 0);
|
||||
|
@ -76,7 +76,6 @@ test_close_all_fds (void)
|
||||
int max_fd = get_max_fds ();
|
||||
int *array;
|
||||
int fd;
|
||||
int dummy_fd;
|
||||
int initial_count, count, n;
|
||||
#if 0
|
||||
char buffer[100];
|
||||
@ -93,10 +92,10 @@ test_close_all_fds (void)
|
||||
free (array);
|
||||
|
||||
/* Some dups to get more file descriptors and close one. */
|
||||
dummy_fd = dup (1);
|
||||
dummy_fd = dup (1);
|
||||
dup (1);
|
||||
dup (1);
|
||||
fd = dup (1);
|
||||
dummy_fd = dup (1);
|
||||
dup (1);
|
||||
close (fd);
|
||||
|
||||
array = xget_all_open_fds ();
|
||||
@ -137,14 +136,14 @@ test_close_all_fds (void)
|
||||
int except[] = { 20, 23, 24, -1 };
|
||||
|
||||
for (n=initial_count; n < 31; n++)
|
||||
dummy_fd = dup (1);
|
||||
dup (1);
|
||||
array = xget_all_open_fds ();
|
||||
if (verbose)
|
||||
print_open_fds (array);
|
||||
free (array);
|
||||
for (n=0; n < 5; n++)
|
||||
{
|
||||
dummy_fd = dup (1);
|
||||
dup (1);
|
||||
array = xget_all_open_fds ();
|
||||
if (verbose)
|
||||
print_open_fds (array);
|
||||
|
@ -81,10 +81,9 @@ test_timegm (void)
|
||||
|
||||
};
|
||||
int tidx;
|
||||
time_t now, atime, counter;
|
||||
time_t now, atime;
|
||||
struct tm tbuf, tbuf2, *tp;
|
||||
|
||||
counter = 0;
|
||||
for (tidx=0; tidx < DIM (tvalues); tidx++)
|
||||
{
|
||||
if (tvalues[tidx].year == -1)
|
||||
|
@ -1,3 +1,14 @@
|
||||
2011-08-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* export.c (transfer_format_to_openpgp): Don't parse unneeded CSUM.
|
||||
|
||||
* import.c (import_secret_one): Use arg OPTIONS instead of global
|
||||
import options var.
|
||||
|
||||
* sig-check.c (do_check): Remove unused var CTX.
|
||||
|
||||
* build-packet.c (do_user_id): Return value.
|
||||
|
||||
2011-07-29 Werner Koch <wk@g10code.com>
|
||||
|
||||
* tdbio.c (open_db): Do not print read-only warning in quiet mode.
|
||||
|
@ -242,19 +242,19 @@ write_fake_data (IOBUF out, gcry_mpi_t a)
|
||||
static int
|
||||
do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
|
||||
{
|
||||
int rc;
|
||||
int rc;
|
||||
|
||||
if( uid->attrib_data )
|
||||
{
|
||||
write_header(out, ctb, uid->attrib_len);
|
||||
rc = iobuf_write( out, uid->attrib_data, uid->attrib_len );
|
||||
}
|
||||
else
|
||||
{
|
||||
write_header2( out, ctb, uid->len, 2 );
|
||||
rc = iobuf_write( out, uid->name, uid->len );
|
||||
}
|
||||
return 0;
|
||||
if (uid->attrib_data)
|
||||
{
|
||||
write_header(out, ctb, uid->attrib_len);
|
||||
rc = iobuf_write( out, uid->attrib_data, uid->attrib_len );
|
||||
}
|
||||
else
|
||||
{
|
||||
write_header2( out, ctb, uid->len, 2 );
|
||||
rc = iobuf_write( out, uid->name, uid->len );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
26
g10/export.c
26
g10/export.c
@ -377,7 +377,6 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
|
||||
u32 s2k_count = 0;
|
||||
size_t npkey, nskey;
|
||||
gcry_mpi_t skey[10]; /* We support up to 9 parameters. */
|
||||
u16 desired_csum;
|
||||
int skeyidx = 0;
|
||||
struct seckey_info *ski;
|
||||
|
||||
@ -509,20 +508,21 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
|
||||
skey[skeyidx++] = NULL;
|
||||
|
||||
gcry_sexp_release (list);
|
||||
list = gcry_sexp_find_token (top_list, "csum", 0);
|
||||
if (list)
|
||||
{
|
||||
string = gcry_sexp_nth_string (list, 1);
|
||||
if (!string)
|
||||
goto bad_seckey;
|
||||
desired_csum = strtoul (string, NULL, 10);
|
||||
xfree (string);
|
||||
}
|
||||
else
|
||||
desired_csum = 0;
|
||||
|
||||
/* We have no need for the CSUM valuel thus we don't parse it. */
|
||||
/* list = gcry_sexp_find_token (top_list, "csum", 0); */
|
||||
/* if (list) */
|
||||
/* { */
|
||||
/* string = gcry_sexp_nth_string (list, 1); */
|
||||
/* if (!string) */
|
||||
/* goto bad_seckey; */
|
||||
/* desired_csum = strtoul (string, NULL, 10); */
|
||||
/* xfree (string); */
|
||||
/* } */
|
||||
/* else */
|
||||
/* desired_csum = 0; */
|
||||
/* gcry_sexp_release (list); list = NULL; */
|
||||
|
||||
gcry_sexp_release (list); list = NULL;
|
||||
gcry_sexp_release (top_list); top_list = NULL;
|
||||
|
||||
/* log_debug ("XXX is_v4=%d\n", is_v4); */
|
||||
|
@ -1596,7 +1596,7 @@ import_secret_one (ctrl_t ctrl, const char *fname, KBNODE keyblock,
|
||||
public key block, and below we will output another one for
|
||||
the secret keys. FIXME? */
|
||||
import_one (ctrl, fname, pub_keyblock, stats,
|
||||
NULL, NULL, opt.import_options, 1);
|
||||
NULL, NULL, options, 1);
|
||||
|
||||
/* Fixme: We should check for an invalid keyblock and
|
||||
cancel the secret key import in this case. */
|
||||
|
@ -2683,7 +2683,6 @@ show_key_with_all_names (KBNODE keyblock, int only_marked, int with_revoker,
|
||||
KBNODE node;
|
||||
int i;
|
||||
int do_warn = 0;
|
||||
byte pk_version = 0;
|
||||
PKT_public_key *primary = NULL;
|
||||
|
||||
if (opt.with_colons)
|
||||
@ -2719,7 +2718,6 @@ show_key_with_all_names (KBNODE keyblock, int only_marked, int with_revoker,
|
||||
do_warn = 1;
|
||||
}
|
||||
|
||||
pk_version = pk->version;
|
||||
primary = pk;
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,6 @@ do_check( PKT_public_key *pk, PKT_signature *sig, gcry_md_hd_t digest,
|
||||
{
|
||||
gcry_mpi_t result = NULL;
|
||||
int rc = 0;
|
||||
struct cmp_help_context_s ctx;
|
||||
|
||||
if( (rc=do_check_messages(pk,sig,r_expired,r_revoked)) )
|
||||
return rc;
|
||||
@ -316,8 +315,6 @@ do_check( PKT_public_key *pk, PKT_signature *sig, gcry_md_hd_t digest,
|
||||
result = encode_md_value (pk, digest, sig->digest_algo );
|
||||
if (!result)
|
||||
return G10ERR_GENERAL;
|
||||
ctx.sig = sig;
|
||||
ctx.md = digest;
|
||||
rc = pk_verify( pk->pubkey_algo, result, sig->data, pk->pkey );
|
||||
gcry_mpi_release (result);
|
||||
|
||||
|
@ -170,7 +170,6 @@ parse_key (const unsigned char *data, size_t datalen,
|
||||
const unsigned char *data_start = data;
|
||||
int i, version, algorithm;
|
||||
size_t n;
|
||||
unsigned long timestamp, expiredate;
|
||||
int npkey;
|
||||
unsigned char hashbuffer[768];
|
||||
const unsigned char *mpi_n = NULL;
|
||||
@ -184,21 +183,15 @@ parse_key (const unsigned char *data, size_t datalen,
|
||||
if (version < 2 || version > 4 )
|
||||
return gpg_error (GPG_ERR_INV_PACKET); /* Invalid version. */
|
||||
|
||||
timestamp = ((data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]));
|
||||
/*timestamp = ((data[0]<<24)|(data[1]<<16)|(data[2]<<8)|(data[3]));*/
|
||||
data +=4; datalen -=4;
|
||||
|
||||
if (version < 4)
|
||||
{
|
||||
unsigned short ndays;
|
||||
|
||||
if (datalen < 2)
|
||||
return gpg_error (GPG_ERR_INV_PACKET);
|
||||
ndays = ((data[0]<<8)|(data[1]));
|
||||
data +=2; datalen -= 2;
|
||||
expiredate = ndays? (timestamp + ndays * 86400L) : 0;
|
||||
}
|
||||
else
|
||||
expiredate = 0; /* This is stored in the self-signature. */
|
||||
|
||||
if (!datalen)
|
||||
return gpg_error (GPG_ERR_INV_PACKET);
|
||||
|
@ -1602,7 +1602,7 @@ open_pcsc_reader_wrapped (const char *portstr)
|
||||
unsigned char msgbuf[9];
|
||||
int err;
|
||||
unsigned int dummy_status;
|
||||
int sw = SW_HOST_CARD_IO_ERROR;
|
||||
|
||||
/* Note that we use the constant and not the fucntion because this
|
||||
code won't be be used under Windows. */
|
||||
const char *wrapperpgm = GNUPG_LIBEXECDIR "/gnupg-pcsc-wrapper";
|
||||
@ -1746,7 +1746,6 @@ open_pcsc_reader_wrapped (const char *portstr)
|
||||
if (err)
|
||||
{
|
||||
log_error ("PC/SC OPEN failed: %s\n", pcsc_error_string (err));
|
||||
sw = pcsc_error_to_sw (err);
|
||||
goto command_failed;
|
||||
}
|
||||
|
||||
|
@ -384,7 +384,7 @@ handle_open (unsigned char *argbuf, size_t arglen)
|
||||
long err;
|
||||
const char * portstr;
|
||||
char *list = NULL;
|
||||
unsigned long nreader, listlen, atrlen;
|
||||
unsigned long nreader, atrlen;
|
||||
char *p;
|
||||
unsigned long card_state, card_protocol;
|
||||
unsigned char atr[33];
|
||||
@ -431,7 +431,6 @@ handle_open (unsigned char *argbuf, size_t arglen)
|
||||
return;
|
||||
}
|
||||
|
||||
listlen = nreader;
|
||||
p = list;
|
||||
while (nreader)
|
||||
{
|
||||
|
@ -375,7 +375,6 @@ main (int argc, char **argv )
|
||||
ARGPARSE_ARGS pargs;
|
||||
int orig_argc;
|
||||
gpg_error_t err;
|
||||
int may_coredump;
|
||||
char **orig_argv;
|
||||
FILE *configfp = NULL;
|
||||
char *configname = NULL;
|
||||
@ -442,7 +441,7 @@ main (int argc, char **argv )
|
||||
setup_libgcrypt_logging ();
|
||||
gcry_control (GCRYCTL_USE_SECURE_RNDPOOL);
|
||||
|
||||
may_coredump = disable_core_dumps ();
|
||||
disable_core_dumps ();
|
||||
|
||||
/* Set default options. */
|
||||
opt.allow_admin = 1;
|
||||
|
@ -1,3 +1,9 @@
|
||||
2011-08-10 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keydb.c (keydb_add_resource): Remove unsued var CREATED_FNAME.
|
||||
|
||||
* gpgsm.c (main): Remove unused var FNAME.
|
||||
|
||||
2011-07-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* call-dirmngr.c (get_cached_cert, get_cached_cert_data_cb): New.
|
||||
|
@ -862,7 +862,6 @@ main ( int argc, char **argv)
|
||||
ARGPARSE_ARGS pargs;
|
||||
int orig_argc;
|
||||
char **orig_argv;
|
||||
const char *fname;
|
||||
/* char *username;*/
|
||||
int may_coredump;
|
||||
strlist_t sl, remusr= NULL, locusr=NULL;
|
||||
@ -1635,8 +1634,6 @@ main ( int argc, char **argv)
|
||||
if (log_get_errorcount(0))
|
||||
gpgsm_exit(1); /* Must stop for invalid recipients. */
|
||||
|
||||
fname = argc? *argv : NULL;
|
||||
|
||||
/* Dispatch command. */
|
||||
switch (cmd)
|
||||
{
|
||||
|
@ -82,7 +82,6 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created)
|
||||
int rc = 0;
|
||||
FILE *fp;
|
||||
KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE;
|
||||
const char *created_fname = NULL;
|
||||
|
||||
if (auto_created)
|
||||
*auto_created = 0;
|
||||
@ -194,7 +193,6 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created)
|
||||
|
||||
if (!opt.quiet)
|
||||
log_info (_("keybox `%s' created\n"), filename);
|
||||
created_fname = filename;
|
||||
if (auto_created)
|
||||
*auto_created = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user