mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Fixed set but unused variable bugs
This commit is contained in:
parent
14442d2be0
commit
816bee1fa0
23 changed files with 84 additions and 80 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue