mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
common/
2010-04-20 Marcus Brinkmann <marcus@g10code.de> * logging.c (do_log_ignore_arg): New helper function. (log_string): Use it to remove ugly volatile hack that causes gcc warning. (log_flush): Likewise. * sysutils.c (gnupg_unsetenv) [!HAVE_W32CE_SYSTEM]: Return something. (gnupg_setenv) [!HAVE_W32CE_SYSTEM]: Likewise. * pka.c (get_pka_info): Solve strict aliasing rule violation. * t-exechelp.c (test_close_all_fds): Use dummy variables to silence gcc warning. kbx/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * keybox-update.c [!HAVE_DOSISH_SYSTEM]: Include ../common/sysutils.h even then to silence gcc warning about missing declaration of gnupg_remove. tools/ 2010-04-20 Marcus Brinkmann <marcus@g10code.de> * gpgconf-comp.c (option_check_validity): Use dummy variables to silence gcc warning.
This commit is contained in:
parent
6616ba9a1e
commit
0e960d940a
@ -1,3 +1,15 @@
|
||||
2010-04-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* logging.c (do_log_ignore_arg): New helper function.
|
||||
(log_string): Use it to remove ugly volatile hack that causes gcc
|
||||
warning.
|
||||
(log_flush): Likewise.
|
||||
* sysutils.c (gnupg_unsetenv) [!HAVE_W32CE_SYSTEM]: Return something.
|
||||
(gnupg_setenv) [!HAVE_W32CE_SYSTEM]: Likewise.
|
||||
* pka.c (get_pka_info): Solve strict aliasing rule violation.
|
||||
* t-exechelp.c (test_close_all_fds): Use dummy variables to
|
||||
silence gcc warning.
|
||||
|
||||
2010-04-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (noinst_LIBRARIES) [W32CE]: Exclude libsimple-pwquery.
|
||||
|
@ -515,16 +515,23 @@ log_logv (int level, const char *fmt, va_list arg_ptr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_log_ignore_arg (int level, const char *str, ...)
|
||||
{
|
||||
va_list arg_ptr;
|
||||
va_start (arg_ptr, str);
|
||||
do_logv (level, 1, str, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
log_string (int level, const char *string)
|
||||
{
|
||||
/* We need to provide a dummy arg_ptr. volatile is needed to
|
||||
suppress compiler warnings. The static is required for gcc 4.4
|
||||
because it seems that it detects that a volatile automatic
|
||||
variable is not any good if not initialized. */
|
||||
static volatile va_list dummy_arg_ptr;
|
||||
|
||||
do_logv (level, 1, string, dummy_arg_ptr);
|
||||
/* We need a dummy arg_ptr, but there is no portable way to create
|
||||
one. So we call the do_logv function through a variadic wrapper.
|
||||
MB: Why not just use "%s"? */
|
||||
do_log_ignore_arg (level, string);
|
||||
}
|
||||
|
||||
|
||||
@ -604,8 +611,7 @@ log_printf (const char *fmt, ...)
|
||||
void
|
||||
log_flush (void)
|
||||
{
|
||||
static volatile va_list dummy_arg_ptr;
|
||||
do_logv (JNLIB_LOG_CONT, 1, NULL, dummy_arg_ptr);
|
||||
do_log_ignore_arg (JNLIB_LOG_CONT, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
20
common/pka.c
20
common/pka.c
@ -180,7 +180,7 @@ get_pka_info (const char *address, unsigned char *fpr)
|
||||
unsigned char *p, *pend;
|
||||
const char *domain;
|
||||
char *name;
|
||||
|
||||
HEADER header;
|
||||
|
||||
domain = strrchr (address, '@');
|
||||
if (!domain || domain == address || !domain[1])
|
||||
@ -196,18 +196,24 @@ get_pka_info (const char *address, unsigned char *fpr)
|
||||
xfree (name);
|
||||
if (anslen < sizeof(HEADER))
|
||||
return NULL; /* DNS resolver returned a too short answer. */
|
||||
if ( (rc=((HEADER*)answer)->rcode) != NOERROR )
|
||||
|
||||
/* Don't despair: A good compiler should optimize this away, as
|
||||
header is just 32 byte and constant at compile time. It's
|
||||
one way to comply with strict aliasing rules. */
|
||||
memcpy (&header, answer, sizeof (header));
|
||||
|
||||
if ( (rc=header.rcode) != NOERROR )
|
||||
return NULL; /* DNS resolver returned an error. */
|
||||
|
||||
/* We assume that PACKETSZ is large enough and don't do dynmically
|
||||
expansion of the buffer. */
|
||||
if (anslen > PACKETSZ)
|
||||
return NULL; /* DNS resolver returned a too long answer */
|
||||
|
||||
qdcount = ntohs (((HEADER*)answer)->qdcount);
|
||||
ancount = ntohs (((HEADER*)answer)->ancount);
|
||||
nscount = ntohs (((HEADER*)answer)->nscount);
|
||||
arcount = ntohs (((HEADER*)answer)->arcount);
|
||||
|
||||
qdcount = ntohs (header.qdcount);
|
||||
ancount = ntohs (header.ancount);
|
||||
nscount = ntohs (header.nscount);
|
||||
arcount = ntohs (header.arcount);
|
||||
|
||||
if (!ancount)
|
||||
return NULL; /* Got no answer. */
|
||||
|
@ -89,6 +89,8 @@ 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)
|
||||
@ -98,14 +100,14 @@ got_fatal_signal (int sig)
|
||||
if (cleanup_fnc)
|
||||
cleanup_fnc ();
|
||||
/* Better don't translate these messages. */
|
||||
write (2, "\n", 1 );
|
||||
res = write (2, "\n", 1 );
|
||||
s = log_get_prefix (NULL);
|
||||
if (s)
|
||||
write(2, s, strlen (s));
|
||||
write (2, ": signal ", 9 );
|
||||
res = write(2, s, strlen (s));
|
||||
res = write (2, ": signal ", 9 );
|
||||
s = get_signal_name(sig);
|
||||
if (s)
|
||||
write (2, s, strlen(s) );
|
||||
res = write (2, s, strlen(s) );
|
||||
else
|
||||
{
|
||||
/* We are in a signal handler so we can't use any kind of printf
|
||||
@ -115,7 +117,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)
|
||||
write (2, "?", 1);
|
||||
res = write (2, "?", 1);
|
||||
else
|
||||
{
|
||||
int i, value, any=0;
|
||||
@ -124,7 +126,7 @@ got_fatal_signal (int sig)
|
||||
{
|
||||
if (value >= i || ((any || i==1) && !(value/i)))
|
||||
{
|
||||
write (2, "0123456789"+(value/i), 1);
|
||||
res = write (2, "0123456789"+(value/i), 1);
|
||||
if ((value/i))
|
||||
any = 1;
|
||||
value %= i;
|
||||
@ -132,7 +134,7 @@ got_fatal_signal (int sig)
|
||||
}
|
||||
}
|
||||
}
|
||||
write (2, " caught ... exiting\n", 20);
|
||||
res = write (2, " caught ... exiting\n", 20);
|
||||
|
||||
/* Reset action to default action and raise signal again */
|
||||
init_one_signal (sig, SIG_DFL, 0);
|
||||
|
@ -604,7 +604,7 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
|
||||
(void)overwrite;
|
||||
return 0;
|
||||
#else
|
||||
setenv (name, value, overwrite);
|
||||
return setenv (name, value, overwrite);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -616,9 +616,9 @@ gnupg_unsetenv (const char *name)
|
||||
return 0;
|
||||
#else
|
||||
# ifdef HAVE_UNSETENV
|
||||
unsetenv (name);
|
||||
return unsetenv (name);
|
||||
# else
|
||||
putenv (name);
|
||||
return putenv (name);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
@ -76,6 +76,7 @@ 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];
|
||||
@ -92,10 +93,10 @@ test_close_all_fds (void)
|
||||
free (array);
|
||||
|
||||
/* Some dups to get more file descriptors and close one. */
|
||||
dup (1);
|
||||
dup (1);
|
||||
dummy_fd = dup (1);
|
||||
dummy_fd = dup (1);
|
||||
fd = dup (1);
|
||||
dup (1);
|
||||
dummy_fd = dup (1);
|
||||
close (fd);
|
||||
|
||||
array = xget_all_open_fds ();
|
||||
@ -136,14 +137,14 @@ test_close_all_fds (void)
|
||||
int except[] = { 20, 23, 24, -1 };
|
||||
|
||||
for (n=initial_count; n < 31; n++)
|
||||
dup (1);
|
||||
dummy_fd = dup (1);
|
||||
array = xget_all_open_fds ();
|
||||
if (verbose)
|
||||
print_open_fds (array);
|
||||
free (array);
|
||||
for (n=0; n < 5; n++)
|
||||
{
|
||||
dup (1);
|
||||
dummy_fd = dup (1);
|
||||
array = xget_all_open_fds ();
|
||||
if (verbose)
|
||||
print_open_fds (array);
|
||||
|
@ -1,3 +1,9 @@
|
||||
2010-04-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* keybox-update.c [!HAVE_DOSISH_SYSTEM]: Include
|
||||
../common/sysutils.h even then to silence gcc warning about
|
||||
missing declaration of gnupg_remove.
|
||||
|
||||
2010-03-23 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (extra_libs): New.
|
||||
|
@ -26,9 +26,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "keybox-defs.h"
|
||||
#ifdef HAVE_DOSISH_SYSTEM
|
||||
#include "../common/sysutils.h"
|
||||
#endif
|
||||
|
||||
#define EXTSEP_S "."
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-04-20 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* gpgconf-comp.c (option_check_validity): Use dummy variables to
|
||||
silence gcc warning.
|
||||
|
||||
2010-04-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (bin_PROGRAMS) [W32CE]: Exclude gpgkey2ssh.
|
||||
|
@ -2241,8 +2241,11 @@ option_check_validity (gc_option_t *option, unsigned long flags,
|
||||
}
|
||||
else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32)
|
||||
{
|
||||
long res;
|
||||
|
||||
gpg_err_set_errno (0);
|
||||
(void) strtol (arg, &arg, 0);
|
||||
res = strtol (arg, &arg, 0);
|
||||
(void) res;
|
||||
|
||||
if (errno)
|
||||
gc_error (1, errno, "invalid argument for option %s",
|
||||
@ -2254,8 +2257,11 @@ option_check_validity (gc_option_t *option, unsigned long flags,
|
||||
}
|
||||
else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32)
|
||||
{
|
||||
unsigned long res;
|
||||
|
||||
gpg_err_set_errno (0);
|
||||
(void) strtoul (arg, &arg, 0);
|
||||
res = strtoul (arg, &arg, 0);
|
||||
(void) res;
|
||||
|
||||
if (errno)
|
||||
gc_error (1, errno, "invalid argument for option %s",
|
||||
|
Loading…
x
Reference in New Issue
Block a user