mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-19 09:02:22 +02: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>
|
2010-04-14 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* Makefile.am (noinst_LIBRARIES) [W32CE]: Exclude libsimple-pwquery.
|
* 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
|
void
|
||||||
log_string (int level, const char *string)
|
log_string (int level, const char *string)
|
||||||
{
|
{
|
||||||
/* We need to provide a dummy arg_ptr. volatile is needed to
|
/* We need a dummy arg_ptr, but there is no portable way to create
|
||||||
suppress compiler warnings. The static is required for gcc 4.4
|
one. So we call the do_logv function through a variadic wrapper.
|
||||||
because it seems that it detects that a volatile automatic
|
MB: Why not just use "%s"? */
|
||||||
variable is not any good if not initialized. */
|
do_log_ignore_arg (level, string);
|
||||||
static volatile va_list dummy_arg_ptr;
|
|
||||||
|
|
||||||
do_logv (level, 1, string, dummy_arg_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -604,8 +611,7 @@ log_printf (const char *fmt, ...)
|
|||||||
void
|
void
|
||||||
log_flush (void)
|
log_flush (void)
|
||||||
{
|
{
|
||||||
static volatile va_list dummy_arg_ptr;
|
do_log_ignore_arg (JNLIB_LOG_CONT, NULL);
|
||||||
do_logv (JNLIB_LOG_CONT, 1, NULL, dummy_arg_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
18
common/pka.c
18
common/pka.c
@ -180,7 +180,7 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||||||
unsigned char *p, *pend;
|
unsigned char *p, *pend;
|
||||||
const char *domain;
|
const char *domain;
|
||||||
char *name;
|
char *name;
|
||||||
|
HEADER header;
|
||||||
|
|
||||||
domain = strrchr (address, '@');
|
domain = strrchr (address, '@');
|
||||||
if (!domain || domain == address || !domain[1])
|
if (!domain || domain == address || !domain[1])
|
||||||
@ -196,7 +196,13 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||||||
xfree (name);
|
xfree (name);
|
||||||
if (anslen < sizeof(HEADER))
|
if (anslen < sizeof(HEADER))
|
||||||
return NULL; /* DNS resolver returned a too short answer. */
|
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. */
|
return NULL; /* DNS resolver returned an error. */
|
||||||
|
|
||||||
/* We assume that PACKETSZ is large enough and don't do dynmically
|
/* We assume that PACKETSZ is large enough and don't do dynmically
|
||||||
@ -204,10 +210,10 @@ get_pka_info (const char *address, unsigned char *fpr)
|
|||||||
if (anslen > PACKETSZ)
|
if (anslen > PACKETSZ)
|
||||||
return NULL; /* DNS resolver returned a too long answer */
|
return NULL; /* DNS resolver returned a too long answer */
|
||||||
|
|
||||||
qdcount = ntohs (((HEADER*)answer)->qdcount);
|
qdcount = ntohs (header.qdcount);
|
||||||
ancount = ntohs (((HEADER*)answer)->ancount);
|
ancount = ntohs (header.ancount);
|
||||||
nscount = ntohs (((HEADER*)answer)->nscount);
|
nscount = ntohs (header.nscount);
|
||||||
arcount = ntohs (((HEADER*)answer)->arcount);
|
arcount = ntohs (header.arcount);
|
||||||
|
|
||||||
if (!ancount)
|
if (!ancount)
|
||||||
return NULL; /* Got no answer. */
|
return NULL; /* Got no answer. */
|
||||||
|
@ -89,6 +89,8 @@ get_signal_name( int signum )
|
|||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
got_fatal_signal (int sig)
|
got_fatal_signal (int sig)
|
||||||
{
|
{
|
||||||
|
/* Dummy result variable to suppress gcc warning. */
|
||||||
|
int res;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (caught_fatal_sig)
|
if (caught_fatal_sig)
|
||||||
@ -98,14 +100,14 @@ got_fatal_signal (int sig)
|
|||||||
if (cleanup_fnc)
|
if (cleanup_fnc)
|
||||||
cleanup_fnc ();
|
cleanup_fnc ();
|
||||||
/* Better don't translate these messages. */
|
/* Better don't translate these messages. */
|
||||||
write (2, "\n", 1 );
|
res = write (2, "\n", 1 );
|
||||||
s = log_get_prefix (NULL);
|
s = log_get_prefix (NULL);
|
||||||
if (s)
|
if (s)
|
||||||
write(2, s, strlen (s));
|
res = write(2, s, strlen (s));
|
||||||
write (2, ": signal ", 9 );
|
res = write (2, ": signal ", 9 );
|
||||||
s = get_signal_name(sig);
|
s = get_signal_name(sig);
|
||||||
if (s)
|
if (s)
|
||||||
write (2, s, strlen(s) );
|
res = write (2, s, strlen(s) );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We are in a signal handler so we can't use any kind of printf
|
/* 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
|
things are messed up because we modify its value. Although
|
||||||
this is a bug in that system, we will protect against it. */
|
this is a bug in that system, we will protect against it. */
|
||||||
if (sig < 0 || sig >= 100000)
|
if (sig < 0 || sig >= 100000)
|
||||||
write (2, "?", 1);
|
res = write (2, "?", 1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i, value, any=0;
|
int i, value, any=0;
|
||||||
@ -124,7 +126,7 @@ got_fatal_signal (int sig)
|
|||||||
{
|
{
|
||||||
if (value >= i || ((any || i==1) && !(value/i)))
|
if (value >= i || ((any || i==1) && !(value/i)))
|
||||||
{
|
{
|
||||||
write (2, "0123456789"+(value/i), 1);
|
res = write (2, "0123456789"+(value/i), 1);
|
||||||
if ((value/i))
|
if ((value/i))
|
||||||
any = 1;
|
any = 1;
|
||||||
value %= i;
|
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 */
|
/* Reset action to default action and raise signal again */
|
||||||
init_one_signal (sig, SIG_DFL, 0);
|
init_one_signal (sig, SIG_DFL, 0);
|
||||||
|
@ -604,7 +604,7 @@ gnupg_setenv (const char *name, const char *value, int overwrite)
|
|||||||
(void)overwrite;
|
(void)overwrite;
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
setenv (name, value, overwrite);
|
return setenv (name, value, overwrite);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -616,9 +616,9 @@ gnupg_unsetenv (const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
# ifdef HAVE_UNSETENV
|
# ifdef HAVE_UNSETENV
|
||||||
unsetenv (name);
|
return unsetenv (name);
|
||||||
# else
|
# else
|
||||||
putenv (name);
|
return putenv (name);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ test_close_all_fds (void)
|
|||||||
int max_fd = get_max_fds ();
|
int max_fd = get_max_fds ();
|
||||||
int *array;
|
int *array;
|
||||||
int fd;
|
int fd;
|
||||||
|
int dummy_fd;
|
||||||
int initial_count, count, n;
|
int initial_count, count, n;
|
||||||
#if 0
|
#if 0
|
||||||
char buffer[100];
|
char buffer[100];
|
||||||
@ -92,10 +93,10 @@ test_close_all_fds (void)
|
|||||||
free (array);
|
free (array);
|
||||||
|
|
||||||
/* Some dups to get more file descriptors and close one. */
|
/* Some dups to get more file descriptors and close one. */
|
||||||
dup (1);
|
dummy_fd = dup (1);
|
||||||
dup (1);
|
dummy_fd = dup (1);
|
||||||
fd = dup (1);
|
fd = dup (1);
|
||||||
dup (1);
|
dummy_fd = dup (1);
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
array = xget_all_open_fds ();
|
array = xget_all_open_fds ();
|
||||||
@ -136,14 +137,14 @@ test_close_all_fds (void)
|
|||||||
int except[] = { 20, 23, 24, -1 };
|
int except[] = { 20, 23, 24, -1 };
|
||||||
|
|
||||||
for (n=initial_count; n < 31; n++)
|
for (n=initial_count; n < 31; n++)
|
||||||
dup (1);
|
dummy_fd = dup (1);
|
||||||
array = xget_all_open_fds ();
|
array = xget_all_open_fds ();
|
||||||
if (verbose)
|
if (verbose)
|
||||||
print_open_fds (array);
|
print_open_fds (array);
|
||||||
free (array);
|
free (array);
|
||||||
for (n=0; n < 5; n++)
|
for (n=0; n < 5; n++)
|
||||||
{
|
{
|
||||||
dup (1);
|
dummy_fd = dup (1);
|
||||||
array = xget_all_open_fds ();
|
array = xget_all_open_fds ();
|
||||||
if (verbose)
|
if (verbose)
|
||||||
print_open_fds (array);
|
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>
|
2010-03-23 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* Makefile.am (extra_libs): New.
|
* Makefile.am (extra_libs): New.
|
||||||
|
@ -26,9 +26,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "keybox-defs.h"
|
#include "keybox-defs.h"
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
|
||||||
#include "../common/sysutils.h"
|
#include "../common/sysutils.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EXTSEP_S "."
|
#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>
|
2010-04-14 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* Makefile.am (bin_PROGRAMS) [W32CE]: Exclude gpgkey2ssh.
|
* 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)
|
else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32)
|
||||||
{
|
{
|
||||||
|
long res;
|
||||||
|
|
||||||
gpg_err_set_errno (0);
|
gpg_err_set_errno (0);
|
||||||
(void) strtol (arg, &arg, 0);
|
res = strtol (arg, &arg, 0);
|
||||||
|
(void) res;
|
||||||
|
|
||||||
if (errno)
|
if (errno)
|
||||||
gc_error (1, errno, "invalid argument for option %s",
|
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)
|
else if (gc_arg_type[option->arg_type].fallback == GC_ARG_TYPE_INT32)
|
||||||
{
|
{
|
||||||
|
unsigned long res;
|
||||||
|
|
||||||
gpg_err_set_errno (0);
|
gpg_err_set_errno (0);
|
||||||
(void) strtoul (arg, &arg, 0);
|
res = strtoul (arg, &arg, 0);
|
||||||
|
(void) res;
|
||||||
|
|
||||||
if (errno)
|
if (errno)
|
||||||
gc_error (1, errno, "invalid argument for option %s",
|
gc_error (1, errno, "invalid argument for option %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user