mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Take advantage of newer gpg-error features.
This commit is contained in:
parent
9577dd45ab
commit
03d3322e5f
@ -1,3 +1,11 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
* configure.ac: Build gpg by default.
|
||||
(GNUPG_SYS_SO_PEERCRED): Removed.
|
||||
|
||||
2006-09-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* autogen.sh: Better detection of the cross compiler kit.
|
||||
|
@ -24,7 +24,7 @@ ACLOCAL_AMFLAGS = -I m4 -I gl/m4
|
||||
AUTOMAKE_OPTIONS = dist-bzip2
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-gpg
|
||||
|
||||
EXTRA_DIST = scripts/config.rpath autogen.sh README.CVS
|
||||
EXTRA_DIST = scripts/config.rpath autogen.sh README.SVN
|
||||
DISTCLEANFILES = g10defs.h
|
||||
|
||||
if BUILD_GPGSM
|
||||
|
2
NEWS
2
NEWS
@ -2,7 +2,7 @@ Noteworthy changes in version 1.9.23
|
||||
-------------------------------------------------
|
||||
|
||||
* Regular man pages for most tools are now build directly from the
|
||||
texinfo source.
|
||||
Texinfo source.
|
||||
|
||||
* The gpg code from 1.4.5 has been fully merged into this release.
|
||||
The configure option --enable-gpg is still required to build this
|
||||
|
4
README
4
README
@ -5,9 +5,7 @@
|
||||
|
||||
GnuPG 1.9 is the future version of GnuPG; it is based on some gnupg-1.3
|
||||
code and the previous newpg package. It will eventually lead to a
|
||||
GnuPG 2.0 release. Note that GnuPG 1.4 and 1.9 are not always in sync
|
||||
and thus features and bug fixes done in 1.4 are not necessary
|
||||
available in 1.9.
|
||||
GnuPG 2.0 release.
|
||||
|
||||
You should use this GnuPG version if you want to use the gpg-agent or
|
||||
gpgsm (the S/MIME variant of gpg). Note that the gpg-agent is also
|
||||
|
19
acinclude.m4
19
acinclude.m4
@ -157,25 +157,6 @@ AC_DEFUN([GNUPG_CHECK_ENDIAN],
|
||||
|
||||
|
||||
|
||||
# Check for the getsockopt SO_PEERCRED
|
||||
AC_DEFUN([GNUPG_SYS_SO_PEERCRED],
|
||||
[ AC_MSG_CHECKING(for SO_PEERCRED)
|
||||
AC_CACHE_VAL(gnupg_cv_sys_so_peercred,
|
||||
[AC_TRY_COMPILE([#include <sys/socket.h>],
|
||||
[struct ucred cr;
|
||||
int cl = sizeof cr;
|
||||
getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
|
||||
gnupg_cv_sys_so_peercred=yes,
|
||||
gnupg_cv_sys_so_peercred=no)
|
||||
])
|
||||
AC_MSG_RESULT($gnupg_cv_sys_so_peercred)
|
||||
if test $gnupg_cv_sys_so_peercred = yes; then
|
||||
AC_DEFINE(HAVE_SO_PEERCRED, 1,
|
||||
[Defined if SO_PEERCRED is supported (Linux)])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
# GNUPG_BUILD_PROGRAM(NAME,DEFAULT)
|
||||
# Add a --enable-NAME option to configure an set the
|
||||
|
@ -1,3 +1,14 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
* call-pinentry.c (start_pinentry): Replaced pipe_connect2 by
|
||||
pipe_connect_ext.
|
||||
* call-scd.c (start_scd): Ditto.
|
||||
* command.c (start_command_handler): Replaced
|
||||
init_connected_socket_server by init_socket_server_ext.
|
||||
|
||||
2006-09-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* preset-passphrase.c (main) [W32]: Check for WSAStartup error.
|
||||
|
@ -238,8 +238,8 @@ start_pinentry (ctrl_t ctrl)
|
||||
no_close_list[i] = -1;
|
||||
|
||||
/* Connect to the pinentry and perform initial handshaking */
|
||||
rc = assuan_pipe_connect2 (&ctx, opt.pinentry_program, argv,
|
||||
no_close_list, atfork_cb, NULL);
|
||||
rc = assuan_pipe_connect_ext (&ctx, opt.pinentry_program, argv,
|
||||
no_close_list, atfork_cb, NULL, 0);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("can't connect to the PIN entry module: %s\n",
|
||||
@ -649,7 +649,7 @@ agent_popup_message_start (ctrl_t ctrl, const char *desc,
|
||||
popup_tid = pth_spawn (tattr, popup_message_thread, NULL);
|
||||
if (!popup_tid)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("error spawning popup message handler: %s\n",
|
||||
strerror (errno) );
|
||||
pth_attr_destroy (tattr);
|
||||
|
@ -217,7 +217,7 @@ start_scd (ctrl_t ctrl)
|
||||
{
|
||||
ctrl->scd_local = xtrycalloc (1, sizeof *ctrl->scd_local);
|
||||
if (!ctrl->scd_local)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
ctrl->scd_local->ctrl_backlink = ctrl;
|
||||
ctrl->scd_local->next_local = scd_local_list;
|
||||
scd_local_list = ctrl->scd_local;
|
||||
@ -316,8 +316,8 @@ start_scd (ctrl_t ctrl)
|
||||
no_close_list[i] = -1;
|
||||
|
||||
/* Connect to the pinentry and perform initial handshaking */
|
||||
rc = assuan_pipe_connect2 (&ctx, opt.scdaemon_program, argv,
|
||||
no_close_list, atfork_cb, NULL);
|
||||
rc = assuan_pipe_connect_ext (&ctx, opt.scdaemon_program, argv,
|
||||
no_close_list, atfork_cb, NULL, 0);
|
||||
if (rc)
|
||||
{
|
||||
log_error ("can't connect to the SCdaemon: %s\n",
|
||||
|
@ -294,7 +294,7 @@ stream_read_byte (estream_t stream, unsigned char *b)
|
||||
if (ret == EOF)
|
||||
{
|
||||
if (es_ferror (stream))
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = gpg_error (GPG_ERR_EOF);
|
||||
*b = 0;
|
||||
@ -317,7 +317,7 @@ stream_write_byte (estream_t stream, unsigned char b)
|
||||
|
||||
ret = es_fputc (b, stream);
|
||||
if (ret == EOF)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
|
||||
@ -335,7 +335,7 @@ stream_read_uint32 (estream_t stream, u32 *uint32)
|
||||
|
||||
ret = es_read (stream, buffer, sizeof (buffer), &bytes_read);
|
||||
if (ret)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
if (bytes_read != sizeof (buffer))
|
||||
@ -368,7 +368,7 @@ stream_write_uint32 (estream_t stream, u32 uint32)
|
||||
|
||||
ret = es_write (stream, buffer, sizeof (buffer), NULL);
|
||||
if (ret)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
|
||||
@ -385,7 +385,7 @@ stream_read_data (estream_t stream, unsigned char *buffer, size_t size)
|
||||
|
||||
ret = es_read (stream, buffer, size, &bytes_read);
|
||||
if (ret)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
if (bytes_read != size)
|
||||
@ -406,7 +406,7 @@ stream_write_data (estream_t stream, const unsigned char *buffer, size_t size)
|
||||
|
||||
ret = es_write (stream, buffer, size, NULL);
|
||||
if (ret)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
|
||||
@ -438,7 +438,7 @@ stream_read_string (estream_t stream, unsigned int secure,
|
||||
buffer = xtrymalloc (length + 1);
|
||||
if (! buffer)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -587,13 +587,13 @@ stream_copy (estream_t dst, estream_t src)
|
||||
if (ret || (! bytes_read))
|
||||
{
|
||||
if (ret)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
break;
|
||||
}
|
||||
ret = es_write (dst, buffer, bytes_read, NULL);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -623,21 +623,21 @@ file_to_buffer (const char *filename, unsigned char **buffer, size_t *buffer_n)
|
||||
stream = es_fopen (filename, "r");
|
||||
if (! stream)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = fstat (es_fileno (stream), &statbuf);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
buffer_new = xtrymalloc (statbuf.st_size);
|
||||
if (! buffer_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -865,7 +865,7 @@ ssh_receive_mpint_list (estream_t stream, int secret,
|
||||
mpis = xtrycalloc (elems_n + 1, sizeof *mpis );
|
||||
if (!mpis)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1040,7 +1040,7 @@ sexp_key_construct (gcry_sexp_t *sexp,
|
||||
sexp_template = xtrymalloc (sexp_template_n);
|
||||
if (! sexp_template)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1048,7 +1048,7 @@ sexp_key_construct (gcry_sexp_t *sexp,
|
||||
arg_list = xtrymalloc (sizeof (*arg_list) * (2 + elems_n + 1));
|
||||
if (! arg_list)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1153,7 +1153,7 @@ sexp_key_extract (gcry_sexp_t sexp,
|
||||
mpis_new = xtrycalloc (elems_n + 1, sizeof *mpis_new );
|
||||
if (!mpis_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1204,7 +1204,7 @@ sexp_key_extract (gcry_sexp_t sexp,
|
||||
comment_new = make_cstring (data, data_n);
|
||||
if (! comment_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1401,7 +1401,7 @@ ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size,
|
||||
stream = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
|
||||
if (! stream)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1417,7 +1417,7 @@ ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size,
|
||||
blob_size_new = es_ftell (stream);
|
||||
if (blob_size_new == -1)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1428,7 +1428,7 @@ ssh_convert_key_to_blob (unsigned char **blob, size_t *blob_size,
|
||||
blob_new = xtrymalloc (blob_size_new);
|
||||
if (! blob_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1520,7 +1520,7 @@ ssh_read_key_public_from_blob (unsigned char *blob, size_t blob_size,
|
||||
blob_stream = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
|
||||
if (! blob_stream)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1684,7 +1684,7 @@ card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn)
|
||||
shadow_info = make_shadow_info (serialno, authkeyid);
|
||||
if (!shadow_info)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (pkbuf);
|
||||
gcry_sexp_release (s_pk);
|
||||
xfree (serialno);
|
||||
@ -1734,7 +1734,7 @@ card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn)
|
||||
*cardsn = xtryasprintf ("cardno:%s", serialno);
|
||||
if (!*cardsn)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (pkbuf);
|
||||
gcry_sexp_release (s_pk);
|
||||
xfree (serialno);
|
||||
@ -1801,7 +1801,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
|
||||
key_blobs = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
|
||||
if (! key_blobs)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1925,7 +1925,7 @@ ssh_handler_request_identities (ctrl_t ctrl,
|
||||
ret = es_fseek (key_blobs, 0, SEEK_SET);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2032,7 +2032,7 @@ data_sign (ctrl_t ctrl, ssh_signature_encoder_t sig_encoder,
|
||||
stream = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
|
||||
if (! stream)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2046,7 +2046,7 @@ data_sign (ctrl_t ctrl, ssh_signature_encoder_t sig_encoder,
|
||||
identifier = make_cstring (identifier_raw, identifier_n);
|
||||
if (! identifier)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2064,7 +2064,7 @@ data_sign (ctrl_t ctrl, ssh_signature_encoder_t sig_encoder,
|
||||
mpis = xtrycalloc (elems_n + 1, sizeof *mpis);
|
||||
if (!mpis)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2098,21 +2098,21 @@ data_sign (ctrl_t ctrl, ssh_signature_encoder_t sig_encoder,
|
||||
sig_blob_n = es_ftell (stream);
|
||||
if (sig_blob_n == -1)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
sig_blob = xtrymalloc (sig_blob_n);
|
||||
if (! sig_blob)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = es_fseek (stream, 0, SEEK_SET);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2269,7 +2269,7 @@ ssh_key_extract_comment (gcry_sexp_t key, char **comment)
|
||||
comment_new = make_cstring (data, data_n);
|
||||
if (! comment_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2299,7 +2299,7 @@ ssh_key_to_protected_buffer (gcry_sexp_t key, const char *passphrase,
|
||||
buffer_new = xtrymalloc_secure (buffer_new_n);
|
||||
if (! buffer_new)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2356,7 +2356,7 @@ ssh_identity_register (ctrl_t ctrl, gcry_sexp_t key, int ttl)
|
||||
"within gpg-agent's key storage"),
|
||||
comment ? comment : "?") < 0)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2364,7 +2364,7 @@ ssh_identity_register (ctrl_t ctrl, gcry_sexp_t key, int ttl)
|
||||
pi = gcry_calloc_secure (1, sizeof (*pi) + 100 + 1);
|
||||
if (!pi)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
pi->max_length = 100;
|
||||
@ -2720,13 +2720,13 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
|
||||
request = es_mopen (NULL, 0, 0, 1, gcry_realloc, gcry_free, "r+");
|
||||
if (! request)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
ret = es_setvbuf (request, NULL, _IONBF, 0);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
err = stream_write_data (request, request_data + 1, request_data_size - 1);
|
||||
@ -2737,7 +2737,7 @@ ssh_request_process (ctrl_t ctrl, estream_t stream_sock)
|
||||
response = es_mopen (NULL, 0, 0, 1, NULL, NULL, "r+");
|
||||
if (! response)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2853,7 +2853,7 @@ start_command_handler_ssh (int sock_client)
|
||||
stream_sock = es_fdopen (sock_client, "r+");
|
||||
if (!stream_sock)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("failed to create stream from socket: %s\n"),
|
||||
gpg_strerror (err));
|
||||
goto out;
|
||||
@ -2863,7 +2863,7 @@ start_command_handler_ssh (int sock_client)
|
||||
ret = es_setvbuf (stream_sock, NULL, _IONBF, 0);
|
||||
if (ret)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("failed to disable buffering "
|
||||
"on socket stream: %s\n"), gpg_strerror (err));
|
||||
goto out;
|
||||
|
@ -585,7 +585,7 @@ cmd_readkey (assuan_context_t ctx, char *line)
|
||||
assert (len);
|
||||
buf = xtrymalloc (len);
|
||||
if (!buf)
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
len = gcry_sexp_sprint (s_pkey, GCRYSEXP_FMT_CANON, buf, len);
|
||||
@ -1038,7 +1038,7 @@ cmd_putval (assuan_context_t ctx, char *line)
|
||||
{
|
||||
vl = xtrymalloc (sizeof *vl + strlen (key) + valuelen);
|
||||
if (!vl)
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
vl->len = valuelen;
|
||||
@ -1221,11 +1221,11 @@ start_command_handler (int listen_fd, int fd)
|
||||
}
|
||||
else if (listen_fd != -1)
|
||||
{
|
||||
rc = assuan_init_socket_server (&ctx, listen_fd);
|
||||
rc = assuan_init_socket_server_ext (&ctx, listen_fd, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = assuan_init_connected_socket_server (&ctx, fd);
|
||||
rc = assuan_init_socket_server_ext (&ctx, fd, 2);
|
||||
ctrl.connection_fd = fd;
|
||||
}
|
||||
if (rc)
|
||||
|
@ -248,7 +248,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
|
||||
again:
|
||||
pi = gcry_calloc_secure (1, sizeof (*pi) + maxbuf + 10);
|
||||
if (!pi)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
pi->max_length = maxbuf-1;
|
||||
pi->min_digits = 0; /* we want a real passphrase */
|
||||
pi->max_digits = 8;
|
||||
@ -264,7 +264,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf)
|
||||
pi2 = gcry_calloc_secure (1, sizeof (*pi) + maxbuf + 10);
|
||||
if (!pi2)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
xfree (pi);
|
||||
return rc;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ modify_description (const char *in, const char *comment, char **result)
|
||||
{
|
||||
*result = out = xtrymalloc (out_len + 1);
|
||||
if (!out)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ unprotect (ctrl_t ctrl, const char *desc_text,
|
||||
|
||||
pi = gcry_calloc_secure (1, sizeof (*pi) + 100);
|
||||
if (!pi)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
pi->max_length = 100;
|
||||
pi->min_digits = 0; /* we want a real passphrase */
|
||||
pi->max_digits = 8;
|
||||
@ -318,7 +318,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
|
||||
fp = fopen (fname, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("can't open `%s': %s\n", fname, strerror (errno));
|
||||
xfree (fname);
|
||||
return rc;
|
||||
@ -326,7 +326,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
|
||||
|
||||
if (fstat (fileno(fp), &st))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("can't stat `%s': %s\n", fname, strerror (errno));
|
||||
xfree (fname);
|
||||
fclose (fp);
|
||||
@ -337,7 +337,7 @@ read_key_file (const unsigned char *grip, gcry_sexp_t *result)
|
||||
buf = xtrymalloc (buflen+1);
|
||||
if (!buf || fread (buf, buflen, 1, fp) != 1)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("error reading `%s': %s\n", fname, strerror (errno));
|
||||
xfree (fname);
|
||||
fclose (fp);
|
||||
@ -394,7 +394,7 @@ agent_key_from_file (ctrl_t ctrl, const char *desc_text,
|
||||
buf = xtrymalloc (len);
|
||||
if (!buf)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
gcry_sexp_release (s_skey);
|
||||
return rc;
|
||||
}
|
||||
@ -435,7 +435,7 @@ agent_key_from_file (ctrl_t ctrl, const char *desc_text,
|
||||
shouldn't be a problem. */
|
||||
char *tmp = xtrymalloc (comment_length+1);
|
||||
if (!tmp)
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
memcpy (tmp, comment, comment_length);
|
||||
@ -593,7 +593,7 @@ agent_public_key_from_file (ctrl_t ctrl,
|
||||
array = xtrycalloc (strlen(elems) + 1, sizeof *array);
|
||||
if (!array)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
gcry_sexp_release (list);
|
||||
gcry_sexp_release (s_skey);
|
||||
return rc;
|
||||
@ -655,7 +655,7 @@ agent_public_key_from_file (ctrl_t ctrl,
|
||||
format = xtrymalloc (15+7*strlen (elems)+10+15+1+1);
|
||||
if (!format)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
for (i=0; array[i]; i++)
|
||||
gcry_mpi_release (array[i]);
|
||||
xfree (array);
|
||||
|
@ -144,7 +144,7 @@ map_spwq_error (int err)
|
||||
case SPWQ_NO_AGENT:
|
||||
return gpg_error (GPG_ERR_NO_AGENT);
|
||||
case SPWQ_SYS_ERROR:
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
case SPWQ_GENERAL_ERROR:
|
||||
default:
|
||||
return gpg_error (GPG_ERR_GENERAL);
|
||||
@ -165,7 +165,7 @@ make_hexstring (const char *src)
|
||||
if (!dst)
|
||||
{
|
||||
log_error ("can not escape string: %s\n",
|
||||
gpg_strerror (gpg_error_from_errno (errno)));
|
||||
gpg_strerror (gpg_error_from_syserror ()));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ preset_passphrase (const char *keygrip)
|
||||
if (rc < 0)
|
||||
{
|
||||
log_error ("reading passphrase failed: %s\n",
|
||||
gpg_strerror (gpg_error_from_errno (errno)));
|
||||
gpg_strerror (gpg_error_from_syserror ()));
|
||||
return;
|
||||
}
|
||||
passphrase[rc] = '\0';
|
||||
@ -230,7 +230,7 @@ preset_passphrase (const char *keygrip)
|
||||
if (rc < 0)
|
||||
{
|
||||
log_error ("caching passphrase failed: %s\n",
|
||||
gpg_strerror (gpg_error_from_errno (errno)));
|
||||
gpg_strerror (gpg_error_from_syserror ()));
|
||||
return;
|
||||
}
|
||||
if (!opt_passphrase)
|
||||
@ -258,7 +258,7 @@ forget_passphrase (const char *keygrip)
|
||||
if (rc < 0)
|
||||
{
|
||||
log_error ("clearing passphrase failed: %s\n",
|
||||
gpg_strerror (gpg_error_from_errno (errno)));
|
||||
gpg_strerror (gpg_error_from_syserror ()));
|
||||
return;
|
||||
}
|
||||
free (line);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
* util.h (out_of_core): Use new gpg_error_from_syserror function.
|
||||
|
||||
* http.c (init_sockets): Changed it to require 2.2 unless it is
|
||||
build within gnupg 1 where we require 1.1 (and not anymore allow
|
||||
for 1.0).
|
||||
|
||||
2006-09-07 Werner Koch <wk@g10code.com>
|
||||
|
||||
* exechelp.c (gnupg_spawn_process): Factor out post fork code to ..
|
||||
|
@ -44,7 +44,7 @@ send_one_option (assuan_context_t ctx, gpg_err_source_t errsource,
|
||||
if (!value || !*value)
|
||||
err = 0; /* Avoid sending empty strings. */
|
||||
else if (asprintf (&optstr, "OPTION %s=%s", name, value ) < 0)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
err = assuan_transact (ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
@ -116,7 +116,7 @@ send_pinentry_environment (assuan_context_t ctx,
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
dft_lc = setlocale (LC_CTYPE, "");
|
||||
#endif
|
||||
@ -142,7 +142,7 @@ send_pinentry_environment (assuan_context_t ctx,
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
dft_lc = setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ b64enc_start (struct b64state *state, FILE *fp, const char *title)
|
||||
{
|
||||
state->title = xtrystrdup (title);
|
||||
if (!state->title)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -130,7 +130,7 @@ b64enc_write (struct b64state *state, const void *buffer, size_t nbytes)
|
||||
return 0;
|
||||
|
||||
write_error:
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
|
||||
gpg_error_t
|
||||
@ -200,7 +200,7 @@ b64enc_finish (struct b64state *state)
|
||||
goto cleanup;
|
||||
|
||||
write_error:
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
|
||||
cleanup:
|
||||
if (state->title)
|
||||
|
@ -96,7 +96,7 @@ build_w32_commandline (const char *pgmname, const char **argv, char **cmdline)
|
||||
|
||||
buf = p = xtrymalloc (n);
|
||||
if (!buf)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
/* fixme: PGMNAME may not contain spaces etc. */
|
||||
p = stpcpy (p, pgmname);
|
||||
@ -342,7 +342,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
||||
}
|
||||
if (!*statusfile)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("can't fdopen pipe for reading: %s\n"), gpg_strerror (err));
|
||||
CloseHandle (pi.hProcess);
|
||||
return err;
|
||||
@ -366,7 +366,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
||||
|
||||
if (pipe (rp) == -1)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating a pipe: %s\n"), strerror (errno));
|
||||
return err;
|
||||
}
|
||||
@ -378,7 +378,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
||||
#endif
|
||||
if (*pid == (pid_t)(-1))
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error forking process: %s\n"), strerror (errno));
|
||||
close (rp[0]);
|
||||
close (rp[1]);
|
||||
@ -399,7 +399,7 @@ gnupg_spawn_process (const char *pgmname, const char *argv[],
|
||||
*statusfile = fdopen (rp[0], "r");
|
||||
if (!*statusfile)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("can't fdopen pipe for reading: %s\n"), strerror (errno));
|
||||
kill (*pid, SIGTERM);
|
||||
*pid = (pid_t)(-1);
|
||||
@ -528,7 +528,7 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
|
||||
return gpg_error (GPG_ERR_BUG);
|
||||
|
||||
if (access (pgmname, X_OK))
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
#ifdef USE_GNU_PTH
|
||||
pid = pth_fork? pth_fork () : fork ();
|
||||
@ -538,7 +538,7 @@ gnupg_spawn_process_detached (const char *pgmname, const char *argv[],
|
||||
if (pid == (pid_t)(-1))
|
||||
{
|
||||
log_error (_("error forking process: %s\n"), strerror (errno));
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
if (!pid)
|
||||
{
|
||||
|
@ -200,6 +200,16 @@ struct http_context_s
|
||||
|
||||
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
|
||||
#if GNUPG_MAJOR_VERSION == 1
|
||||
#define REQ_WINSOCK_MAJOR 1
|
||||
#define REQ_WINSOCK_MINOR 1
|
||||
#else
|
||||
#define REQ_WINSOCK_MAJOR 2
|
||||
#define REQ_WINSOCK_MINOR 2
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
deinit_sockets (void)
|
||||
{
|
||||
@ -215,16 +225,18 @@ init_sockets (void)
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
if ( WSAStartup( 0x0101, &wsdata ) )
|
||||
if ( WSAStartup( MAKEWORD (REQ_WINSOCK_MINOR, REQ_WINSOCK_MAJOR), &wsdata ) )
|
||||
{
|
||||
log_error ("error initializing socket library: ec=%d\n",
|
||||
(int)WSAGetLastError () );
|
||||
return;
|
||||
}
|
||||
if ( wsdata.wVersion < 0x0001 )
|
||||
if ( LOBYTE(wsdata.wVersion) != REQ_WINSOCK_MAJOR
|
||||
|| HIBYTE(wsdata.wVersion) != REQ_WINSOCK_MINOR )
|
||||
{
|
||||
log_error ("socket library version is %x.%x - but 1.1 needed\n",
|
||||
LOBYTE(wsdata.wVersion), HIBYTE(wsdata.wVersion));
|
||||
log_error ("socket library version is %x.%x - but %d.%d needed\n",
|
||||
LOBYTE(wsdata.wVersion), HIBYTE(wsdata.wVersion)
|
||||
REQ_WINSOCK_MAJOR, REQ_WINSOCK_MINOR);
|
||||
WSACleanup();
|
||||
return;
|
||||
}
|
||||
@ -313,7 +325,7 @@ http_open (http_t *r_hd, http_req_t reqtype, const char *url,
|
||||
/* Create the handle. */
|
||||
hd = xtrycalloc (1, sizeof *hd);
|
||||
if (!hd)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
hd->sock = -1;
|
||||
hd->req_type = reqtype;
|
||||
hd->flags = flags;
|
||||
@ -383,7 +395,7 @@ http_wait_response (http_t hd)
|
||||
{
|
||||
hd->sock = dup (hd->sock);
|
||||
if (hd->sock == -1)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
P_ES(fclose) (hd->fp_write);
|
||||
hd->fp_write = NULL;
|
||||
@ -401,7 +413,7 @@ http_wait_response (http_t hd)
|
||||
|
||||
cookie = xtrycalloc (1, sizeof *cookie);
|
||||
if (!cookie)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
cookie->fd = hd->sock;
|
||||
if (hd->uri->use_tls)
|
||||
cookie->tls_session = hd->tls_context;
|
||||
@ -410,13 +422,13 @@ http_wait_response (http_t hd)
|
||||
if (!hd->fp_read)
|
||||
{
|
||||
xfree (cookie);
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
}
|
||||
#else /*!HTTP_USE_ESTREAM*/
|
||||
hd->fp_read = fdopen (hd->sock, "r");
|
||||
if (!hd->fp_read)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
#endif /*!HTTP_USE_ESTREAM*/
|
||||
|
||||
err = parse_response (hd);
|
||||
@ -851,7 +863,7 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
uri->auth, strlen(uri->auth));
|
||||
if (!proxy_authstr)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
http_release_parsed_uri (uri);
|
||||
return err;
|
||||
}
|
||||
@ -919,7 +931,7 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
if (!myauth)
|
||||
{
|
||||
xfree (proxy_authstr);
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
remove_escapes (myauth);
|
||||
}
|
||||
@ -937,13 +949,13 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
if (!authstr)
|
||||
{
|
||||
xfree (proxy_authstr);
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
}
|
||||
|
||||
p = build_rel_path (hd->uri);
|
||||
if (!p)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
request = xtrymalloc (2 * strlen (server)
|
||||
+ strlen (p)
|
||||
@ -952,7 +964,7 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
+ 100);
|
||||
if (!request)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (p);
|
||||
xfree (authstr);
|
||||
xfree (proxy_authstr);
|
||||
@ -997,7 +1009,7 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
cookie = xtrycalloc (1, sizeof *cookie);
|
||||
if (!cookie)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
cookie->fd = hd->sock;
|
||||
@ -1011,10 +1023,10 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
if (!hd->fp_write)
|
||||
{
|
||||
xfree (cookie);
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
}
|
||||
else if (es_fputs (request, hd->fp_write) || es_fflush (hd->fp_write))
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
}
|
||||
@ -1030,7 +1042,7 @@ send_request (http_t hd, const char *auth, const char *proxy)
|
||||
{
|
||||
hd->fp_write = fdopen (hd->sock, "w");
|
||||
if (!hd->fp_write)
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
}
|
||||
#endif /*!HTTP_USE_ESTREAM*/
|
||||
|
||||
@ -1237,7 +1249,7 @@ store_header (http_t hd, char *line)
|
||||
n += strlen (hd->headers->value);
|
||||
p = xtrymalloc (n+1);
|
||||
if (!p)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
strcpy (stpcpy (p, hd->headers->value), line);
|
||||
xfree (hd->headers->value);
|
||||
hd->headers->value = p;
|
||||
@ -1262,7 +1274,7 @@ store_header (http_t hd, char *line)
|
||||
it is a comma separated list and merge them. */
|
||||
p = xtrymalloc (strlen (h->value) + 1 + strlen (value)+ 1);
|
||||
if (!p)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
strcpy (stpcpy (stpcpy (p, h->value), ","), value);
|
||||
xfree (h->value);
|
||||
h->value = p;
|
||||
@ -1272,13 +1284,13 @@ store_header (http_t hd, char *line)
|
||||
/* Append a new header. */
|
||||
h = xtrymalloc (sizeof *h + strlen (line));
|
||||
if (!h)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
strcpy (h->name, line);
|
||||
h->value = xtrymalloc (strlen (value)+1);
|
||||
if (!h->value)
|
||||
{
|
||||
xfree (h);
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
strcpy (h->value, value);
|
||||
h->next = hd->headers;
|
||||
@ -1334,7 +1346,7 @@ parse_response (http_t hd)
|
||||
len = my_read_line (hd->fp_read, &hd->buffer, &hd->buffer_size, &maxlen);
|
||||
line = hd->buffer;
|
||||
if (!line)
|
||||
return gpg_error_from_errno (errno); /* Out of core. */
|
||||
return gpg_error_from_syserror (); /* Out of core. */
|
||||
if (!maxlen)
|
||||
return gpg_error (GPG_ERR_TRUNCATED); /* Line has been truncated. */
|
||||
if (!len)
|
||||
@ -1378,7 +1390,7 @@ parse_response (http_t hd)
|
||||
len = my_read_line (hd->fp_read, &hd->buffer, &hd->buffer_size, &maxlen);
|
||||
line = hd->buffer;
|
||||
if (!line)
|
||||
return gpg_error_from_errno (errno); /* Out of core. */
|
||||
return gpg_error_from_syserror (); /* Out of core. */
|
||||
/* Note, that we can silently ignore truncated lines. */
|
||||
if (!len)
|
||||
return gpg_error (GPG_ERR_EOF);
|
||||
@ -1700,7 +1712,7 @@ write_server (int sock, const char *data, size_t length)
|
||||
continue;
|
||||
}
|
||||
log_info ("network write failed: %s\n", strerror (errno));
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
nleft -= nwritten;
|
||||
|
@ -392,7 +392,7 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
|
||||
}
|
||||
else if (ferror (f) && errno != EPIPE)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("%s: read error: %s\n", a->fname, strerror (errno));
|
||||
}
|
||||
*ret_len = nbytes;
|
||||
@ -406,7 +406,7 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
|
||||
nbytes = fwrite (buf, 1, size, f);
|
||||
if (ferror (f))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("%s: write error: %s\n", a->fname, strerror (errno));
|
||||
}
|
||||
}
|
||||
@ -481,7 +481,7 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
|
||||
{ /* error */
|
||||
if (errno != EPIPE)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("%s: read error: %s\n",
|
||||
a->fname, strerror (errno));
|
||||
}
|
||||
@ -543,7 +543,7 @@ file_filter (void *opaque, int control, iobuf_t chain, byte * buf,
|
||||
while (n != -1 && nbytes);
|
||||
if (n == -1)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("%s: write error: %s\n", a->fname, strerror (errno));
|
||||
}
|
||||
nbytes = p - buf;
|
||||
@ -849,14 +849,14 @@ block_filter (void *opaque, int control, iobuf_t chain, byte * buffer,
|
||||
{ /* write stuff from the buffer */
|
||||
assert (n == OP_MIN_PARTIAL_CHUNK);
|
||||
if (iobuf_write (chain, a->buffer, n))
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
a->buflen = 0;
|
||||
nbytes -= n;
|
||||
}
|
||||
if ((n = nbytes) > blen)
|
||||
n = blen;
|
||||
if (n && iobuf_write (chain, p, n))
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
p += n;
|
||||
nbytes -= n;
|
||||
}
|
||||
@ -935,7 +935,7 @@ block_filter (void *opaque, int control, iobuf_t chain, byte * buffer,
|
||||
{
|
||||
log_error ("block_filter: write error: %s\n",
|
||||
strerror (errno));
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
}
|
||||
xfree (a->buffer);
|
||||
a->buffer = NULL;
|
||||
@ -1649,7 +1649,7 @@ underflow (iobuf_t a)
|
||||
if (len < a->d.size)
|
||||
{
|
||||
if (ferror (fp))
|
||||
a->error = gpg_error_from_errno (errno);
|
||||
a->error = gpg_error_from_syserror ();
|
||||
}
|
||||
a->d.len = len;
|
||||
a->d.start = 0;
|
||||
|
@ -99,7 +99,7 @@ is_file_compressed (const char *s, int *ret_rc)
|
||||
|
||||
a = iobuf_open( s );
|
||||
if ( a == NULL ) {
|
||||
*ret_rc = gpg_error_from_errno (errno);
|
||||
*ret_rc = gpg_error_from_syserror ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -71,9 +71,7 @@
|
||||
static inline gpg_error_t
|
||||
out_of_core (void)
|
||||
{
|
||||
return gpg_error (errno
|
||||
? gpg_err_code_from_errno(errno)
|
||||
: GPG_ERR_MISSING_ERRNO);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
|
||||
/* A type to hold the ISO time. Note that this this is the same as
|
||||
|
@ -76,7 +76,7 @@ use_exec=yes
|
||||
disable_keyserver_path=no
|
||||
|
||||
|
||||
GNUPG_BUILD_PROGRAM(gpg, no)
|
||||
GNUPG_BUILD_PROGRAM(gpg, yes)
|
||||
GNUPG_BUILD_PROGRAM(gpgsm, yes)
|
||||
GNUPG_BUILD_PROGRAM(agent, yes)
|
||||
GNUPG_BUILD_PROGRAM(scdaemon, yes)
|
||||
@ -946,11 +946,6 @@ if test "$ac_cv_sizeof_unsigned_short" = "0" \
|
||||
AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
|
||||
fi
|
||||
|
||||
#
|
||||
# fixme: do we really need this - it should be encapsulated in libassuan
|
||||
#
|
||||
GNUPG_SYS_SO_PEERCRED
|
||||
|
||||
|
||||
#
|
||||
# Checks for library functions.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
2006-09-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* gpg.c (main): Made --require-cross-certification the default.
|
||||
|
@ -104,7 +104,7 @@ start_agent (void)
|
||||
|
||||
if (fflush (NULL))
|
||||
{
|
||||
gpg_error_t tmperr = gpg_error_from_errno (errno);
|
||||
gpg_error_t tmperr = gpg_error_from_syserror ();
|
||||
log_error ("error flushing pending output: %s\n", strerror (errno));
|
||||
return tmperr;
|
||||
}
|
||||
@ -191,7 +191,7 @@ start_agent (void)
|
||||
char *optstr;
|
||||
if (asprintf (&optstr, "OPTION display=%s",
|
||||
opt.display ? opt.display : dft_display) < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
free (optstr);
|
||||
@ -209,7 +209,7 @@ start_agent (void)
|
||||
char *optstr;
|
||||
if (asprintf (&optstr, "OPTION ttyname=%s",
|
||||
opt.ttyname ? opt.ttyname : dft_ttyname) < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
free (optstr);
|
||||
@ -222,7 +222,7 @@ start_agent (void)
|
||||
char *optstr;
|
||||
if (asprintf (&optstr, "OPTION ttytype=%s",
|
||||
opt.ttyname ? opt.ttytype : dft_ttytype) < 0)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL);
|
||||
free (optstr);
|
||||
@ -235,7 +235,7 @@ start_agent (void)
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
}
|
||||
dft_lc = setlocale (LC_CTYPE, "");
|
||||
@ -245,7 +245,7 @@ start_agent (void)
|
||||
char *optstr;
|
||||
if (asprintf (&optstr, "OPTION lc-ctype=%s",
|
||||
opt.lc_ctype ? opt.lc_ctype : dft_lc) < 0)
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
@ -268,7 +268,7 @@ start_agent (void)
|
||||
{
|
||||
old_lc = strdup (old_lc);
|
||||
if (!old_lc)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
dft_lc = setlocale (LC_MESSAGES, "");
|
||||
#endif
|
||||
@ -277,7 +277,7 @@ start_agent (void)
|
||||
char *optstr;
|
||||
if (asprintf (&optstr, "OPTION lc-messages=%s",
|
||||
opt.lc_messages ? opt.lc_messages : dft_lc) < 0)
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
{
|
||||
rc = assuan_transact (agent_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
|
||||
|
@ -58,7 +58,7 @@ dearmor_file( const char *fname )
|
||||
errno = EPERM;
|
||||
}
|
||||
if (!inp) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
goto leave;
|
||||
@ -107,7 +107,7 @@ enarmor_file( const char *fname )
|
||||
errno = EPERM;
|
||||
}
|
||||
if (!inp) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
goto leave;
|
||||
|
@ -66,7 +66,7 @@ decrypt_message( const char *filename )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"), print_fname_stdin(filename),
|
||||
gpg_strerror (rc));
|
||||
return rc;
|
||||
|
@ -189,7 +189,7 @@ encode_simple( const char *filename, int mode, int use_seskey )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), filename? filename: "[stdin]",
|
||||
strerror(errno) );
|
||||
return rc;
|
||||
@ -481,7 +481,7 @@ encode_crypt( const char *filename, STRLIST remusr, int use_symkey )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"),
|
||||
filename? filename: "[stdin]",
|
||||
gpg_strerror (rc) );
|
||||
|
@ -441,7 +441,7 @@ int exec_write(struct exec_info **info,const char *program,
|
||||
(*info)->tochild=fdopen(to[1],binary?"wb":"w");
|
||||
if((*info)->tochild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
ret = gpg_error_from_syserror ();
|
||||
close(to[1]);
|
||||
goto fail;
|
||||
}
|
||||
@ -451,7 +451,7 @@ int exec_write(struct exec_info **info,const char *program,
|
||||
(*info)->fromchild=iobuf_fdopen(from[0],"r");
|
||||
if((*info)->fromchild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
ret = gpg_error_from_syserror ();
|
||||
close(from[0]);
|
||||
goto fail;
|
||||
}
|
||||
@ -476,7 +476,7 @@ int exec_write(struct exec_info **info,const char *program,
|
||||
(*info)->tochild=fopen((*info)->tempfile_in,binary?"wb":"w");
|
||||
if((*info)->tochild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
ret = gpg_error_from_syserror ();
|
||||
log_error(_("can't create `%s': %s\n"),
|
||||
(*info)->tempfile_in,strerror(errno));
|
||||
goto fail;
|
||||
@ -550,7 +550,7 @@ int exec_read(struct exec_info *info)
|
||||
}
|
||||
if(info->fromchild==NULL)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
ret = gpg_error_from_syserror ();
|
||||
log_error(_("unable to read external program response: %s\n"),
|
||||
strerror(errno));
|
||||
goto fail;
|
||||
|
@ -1834,7 +1834,7 @@ main (int argc, char **argv )
|
||||
opt.rfc2440_text=1;
|
||||
opt.def_sig_expire="0";
|
||||
opt.def_cert_expire="0";
|
||||
opt.require_cross_cert = 1;
|
||||
opt.flags.require_cross_cert = 1;
|
||||
set_homedir ( default_homedir () );
|
||||
|
||||
/* Check whether we have a config file on the command line. */
|
||||
|
@ -112,7 +112,7 @@ maybe_create_keyring (char *filename, int force)
|
||||
}
|
||||
if (access (filename, F_OK))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
*last_slash_in_filename = DIRSEP_C;
|
||||
goto leave;
|
||||
}
|
||||
@ -166,7 +166,7 @@ maybe_create_keyring (char *filename, int force)
|
||||
umask (oldmask);
|
||||
if (!iobuf)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ( _("error creating keyring `%s': %s\n"),
|
||||
filename, strerror(errno));
|
||||
goto leave;
|
||||
|
@ -3732,7 +3732,7 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
|
||||
umask (oldmask);
|
||||
if (!fp)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't create backup file `%s': %s\n"),
|
||||
fname, strerror(errno) );
|
||||
xfree (fname);
|
||||
|
@ -661,7 +661,7 @@ prepare_search (KEYRING_HANDLE hd)
|
||||
hd->current.iobuf = iobuf_open (hd->current.kr->fname);
|
||||
if (!hd->current.iobuf)
|
||||
{
|
||||
hd->current.error = gpg_error_from_errno (errno);
|
||||
hd->current.error = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s'\n"), hd->current.kr->fname );
|
||||
return hd->current.error;
|
||||
}
|
||||
@ -1200,7 +1200,7 @@ create_tmp_file (const char *template,
|
||||
umask(oldmask);
|
||||
if (!*r_fp)
|
||||
{
|
||||
int rc = gpg_error_from_errno (errno);
|
||||
int rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't create `%s': %s\n"), tmpfname, strerror(errno) );
|
||||
xfree (tmpfname);
|
||||
xfree (bakfname);
|
||||
@ -1232,7 +1232,7 @@ rename_tmp_file (const char *bakfname, const char *tmpfname,
|
||||
#endif
|
||||
if (rename (fname, bakfname) )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("renaming `%s' to `%s' failed: %s\n",
|
||||
fname, bakfname, strerror(errno) );
|
||||
return rc;
|
||||
@ -1247,7 +1247,7 @@ rename_tmp_file (const char *bakfname, const char *tmpfname,
|
||||
unregister_secured_file (fname);
|
||||
if (rename (tmpfname, fname) )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("renaming `%s' to `%s' failed: %s\n"),
|
||||
tmpfname, fname, strerror(errno) );
|
||||
register_secured_file (fname);
|
||||
@ -1317,7 +1317,7 @@ write_keyblock (IOBUF fp, KBNODE keyblock)
|
||||
iobuf_put (fp, 0); /* unused */
|
||||
if (iobuf_put (fp, cacheval))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("writing sigcache packet failed\n");
|
||||
return rc;
|
||||
}
|
||||
@ -1362,7 +1362,7 @@ keyring_rebuild_cache (void *token,int noisy)
|
||||
{
|
||||
if (iobuf_close (tmpfp))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("error closing `%s': %s\n",
|
||||
tmpfilename, strerror (errno));
|
||||
goto leave;
|
||||
@ -1442,7 +1442,7 @@ keyring_rebuild_cache (void *token,int noisy)
|
||||
{
|
||||
if (iobuf_close (tmpfp))
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("error closing `%s': %s\n",
|
||||
tmpfilename, strerror (errno));
|
||||
goto leave;
|
||||
@ -1486,7 +1486,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
||||
/* Open the source file. Because we do a rename, we have to check the
|
||||
permissions of the file */
|
||||
if (access (fname, W_OK))
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
fp = iobuf_open (fname);
|
||||
if (mode == 1 && !fp && errno == ENOENT) {
|
||||
@ -1504,7 +1504,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
||||
umask(oldmask);
|
||||
if( !newfp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't create `%s': %s\n"), fname, strerror(errno));
|
||||
return rc;
|
||||
}
|
||||
@ -1521,7 +1521,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
||||
}
|
||||
}
|
||||
if( iobuf_close(newfp) ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("%s: close failed: %s\n", fname, strerror(errno));
|
||||
return rc;
|
||||
}
|
||||
@ -1530,7 +1530,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
||||
|
||||
if( !fp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
@ -1613,12 +1613,12 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
||||
|
||||
/* close both files */
|
||||
if( iobuf_close(fp) ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error("%s: close failed: %s\n", fname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
if( iobuf_close(newfp) ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error("%s: close failed: %s\n", tmpfname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
|
@ -1406,7 +1406,7 @@ keyserver_spawn(enum ks_action action,STRLIST list,KEYDB_SEARCH_DESC *desc,
|
||||
maxlen=1024;
|
||||
if(iobuf_read_line(spawn->fromchild,&line,&buflen,&maxlen)==0)
|
||||
{
|
||||
ret = gpg_error_from_errno (errno);
|
||||
ret = gpg_error_from_syserror ();
|
||||
goto fail; /* i.e. EOF */
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
||||
if( iobuf_is_pipe_filename (iname) && !opt.outfile ) {
|
||||
*a = iobuf_create(NULL);
|
||||
if( !*a ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), "[stdout]", strerror(errno) );
|
||||
}
|
||||
else if( opt.verbose )
|
||||
@ -261,7 +261,7 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
||||
*a = iobuf_create( name );
|
||||
if( !*a )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't create `%s': %s\n"), name, strerror(errno) );
|
||||
}
|
||||
else if( opt.verbose )
|
||||
|
@ -132,12 +132,12 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
else if (is_secured_filename (fname))
|
||||
{
|
||||
errno = EPERM;
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
else if( !(fp = fopen(fname,"wb")) ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
@ -187,7 +187,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
if( convert ) { /* text mode */
|
||||
for( ; pt->len; pt->len-- ) {
|
||||
if( (c = iobuf_get(pt->buf)) == -1 ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("problem reading source (%u bytes remaining)\n",
|
||||
(unsigned)pt->len);
|
||||
goto leave;
|
||||
@ -210,7 +210,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
else if( putc( c, fp ) == EOF )
|
||||
{
|
||||
if (ferror (fp))
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
rc = gpg_error (GPG_ERR_EOF);
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
@ -226,7 +226,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
int len = pt->len > 32768 ? 32768 : pt->len;
|
||||
len = iobuf_read( pt->buf, buffer, len );
|
||||
if( len == -1 ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("problem reading source (%u bytes remaining)\n",
|
||||
(unsigned)pt->len);
|
||||
xfree( buffer );
|
||||
@ -246,7 +246,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
}
|
||||
else if( fwrite( buffer, 1, len, fp ) != len )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
xfree( buffer );
|
||||
@ -279,7 +279,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
else if( putc( c, fp ) == EOF )
|
||||
{
|
||||
if ( ferror (fp ) )
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
else
|
||||
rc = gpg_error (GPG_ERR_EOF);
|
||||
log_error("error writing to `%s': %s\n",
|
||||
@ -317,7 +317,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
goto leave;
|
||||
}
|
||||
else if( fwrite( buffer, 1, len, fp ) != len ) {
|
||||
rc = (errno? gpg_error_from_errno (errno)
|
||||
rc = (errno? gpg_error_from_syserror ()
|
||||
: gpg_error (GPG_ERR_INTERNAL));
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
@ -345,7 +345,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
}
|
||||
else if( putc( c, fp ) == EOF )
|
||||
{
|
||||
rc = (errno? gpg_error_from_errno (errno)
|
||||
rc = (errno? gpg_error_from_syserror ()
|
||||
: gpg_error (GPG_ERR_INTERNAL));
|
||||
log_error ("error writing to `%s': %s\n",
|
||||
fname, strerror(errno) );
|
||||
@ -385,7 +385,7 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
||||
}
|
||||
|
||||
if( fp && fp != stdout && fclose(fp) ) {
|
||||
rc = (errno? gpg_error_from_errno (errno)
|
||||
rc = (errno? gpg_error_from_syserror ()
|
||||
: gpg_error (GPG_ERR_INTERNAL));
|
||||
log_error ("error closing `%s': %s\n", fname, strerror(errno) );
|
||||
fp = NULL;
|
||||
@ -487,7 +487,7 @@ ask_for_detached_datafile (gcry_md_hd_t md, gcry_md_hd_t md2,
|
||||
}
|
||||
else if( !fp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"), answer, strerror(errno));
|
||||
goto leave;
|
||||
}
|
||||
@ -544,7 +544,7 @@ hash_datafiles( gcry_md_hd_t md, gcry_md_hd_t md2, STRLIST files,
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
int rc = gpg_error_from_errno (errno);
|
||||
int rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open signed data `%s'\n"),
|
||||
print_fname_stdin(sl->d));
|
||||
return rc;
|
||||
|
12
g10/sign.c
12
g10/sign.c
@ -808,7 +808,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
}
|
||||
if( !inp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"), fname? fname: "[stdin]",
|
||||
strerror(errno) );
|
||||
goto leave;
|
||||
@ -826,7 +826,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
out = iobuf_create( outfile );
|
||||
if( !out )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't create `%s': %s\n"), outfile, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
||||
}
|
||||
if( !inp )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"),
|
||||
sl->d,strerror(errno));
|
||||
goto leave;
|
||||
@ -1116,7 +1116,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"),
|
||||
fname? fname: "[stdin]", strerror(errno) );
|
||||
goto leave;
|
||||
@ -1132,7 +1132,7 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
||||
out = iobuf_create( outfile );
|
||||
if( !out )
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't create `%s': %s\n"), outfile, strerror(errno) );
|
||||
goto leave;
|
||||
}
|
||||
@ -1268,7 +1268,7 @@ sign_symencrypt_file (const char *fname, STRLIST locusr)
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !inp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"),
|
||||
fname? fname: "[stdin]", strerror(errno) );
|
||||
goto leave;
|
||||
|
12
g10/tdbio.c
12
g10/tdbio.c
@ -126,14 +126,14 @@ write_cache_item( CACHE_CTRL r )
|
||||
int n;
|
||||
|
||||
if( lseek( db_fd, r->recno * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb rec %lu: lseek failed: %s\n"),
|
||||
r->recno, strerror(errno) );
|
||||
return err;
|
||||
}
|
||||
n = write( db_fd, r->data, TRUST_RECORD_LEN);
|
||||
if( n != TRUST_RECORD_LEN ) {
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb rec %lu: write failed (n=%d): %s\n"),
|
||||
r->recno, n, strerror(errno) );
|
||||
return err;
|
||||
@ -1162,7 +1162,7 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
|
||||
buf = get_record_from_cache( recnum );
|
||||
if( !buf ) {
|
||||
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb: lseek failed: %s\n"), strerror(errno) );
|
||||
return err;
|
||||
}
|
||||
@ -1171,7 +1171,7 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
|
||||
return -1; /* eof */
|
||||
}
|
||||
else if( n != TRUST_RECORD_LEN ) {
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb: read failed (n=%d): %s\n"), n,
|
||||
strerror(errno) );
|
||||
return err;
|
||||
@ -1435,14 +1435,14 @@ tdbio_new_recnum()
|
||||
rec.recnum = recnum;
|
||||
rc = 0;
|
||||
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb rec %lu: lseek failed: %s\n"),
|
||||
recnum, strerror(errno) );
|
||||
}
|
||||
else {
|
||||
int n = write( db_fd, &rec, TRUST_RECORD_LEN);
|
||||
if( n != TRUST_RECORD_LEN ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("trustdb rec %lu: write failed (n=%d): %s\n"),
|
||||
recnum, n, strerror(errno) );
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ verify_signatures( int nfiles, char **files )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"),
|
||||
print_fname_stdin(sigfile), strerror (errno));
|
||||
return rc;
|
||||
@ -154,7 +154,7 @@ verify_one_file( const char *name )
|
||||
errno = EPERM;
|
||||
}
|
||||
if( !fp ) {
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error(_("can't open `%s': %s\n"),
|
||||
print_fname_stdin(name), strerror (errno));
|
||||
print_file_status( STATUS_FILE_ERROR, name, 1 );
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
2005-10-08 Marcus Brinkmann <marcus@g10code.de>
|
||||
|
||||
* Makefile.am (kbxutil_LDADD): Add ../gl/libgnu.a after
|
||||
|
@ -405,7 +405,7 @@ _keybox_parse_openpgp (const unsigned char *image, size_t imagelen,
|
||||
u = xtrycalloc (1, sizeof *u);
|
||||
if (!u)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
break;
|
||||
}
|
||||
u->off = data - image_start;
|
||||
@ -447,7 +447,7 @@ _keybox_parse_openpgp (const unsigned char *image, size_t imagelen,
|
||||
k = xtrycalloc (1, sizeof *k);
|
||||
if (!k)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
break;
|
||||
}
|
||||
err = parse_key (data, datalen, k);
|
||||
|
@ -1,3 +1,11 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
* command.c (scd_command_handler): Replaced
|
||||
init_connected_socket_server by init_socket_server_ext.
|
||||
|
||||
2006-09-07 Werner Koch <wk@g10code.com>
|
||||
|
||||
* command.c (update_reader_status_file): Execute an event handler
|
||||
|
@ -566,7 +566,7 @@ store_fpr (int slot, int keynumber, u32 timestamp,
|
||||
n = 6 + 2 + mlen + 2 + elen;
|
||||
p = buffer = xtrymalloc (3 + n);
|
||||
if (!buffer)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
*p++ = 0x99; /* ctb */
|
||||
*p++ = n >> 8; /* 2 byte length header */
|
||||
@ -880,7 +880,7 @@ retrieve_key_material (FILE *fp, const char *hexkeyid,
|
||||
break; /* EOF. */
|
||||
if (i < 0)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave; /* Error. */
|
||||
}
|
||||
if (!max_length)
|
||||
@ -1036,7 +1036,7 @@ get_public_key (app_t app, int keyno)
|
||||
mbuf = xtrymalloc ( mlen + 1);
|
||||
if (!mbuf)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
*mbuf = 0;
|
||||
@ -1049,7 +1049,7 @@ get_public_key (app_t app, int keyno)
|
||||
ebuf = xtrymalloc ( elen + 1);
|
||||
if (!ebuf)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
*ebuf = 0;
|
||||
@ -1091,7 +1091,7 @@ get_public_key (app_t app, int keyno)
|
||||
fpr);
|
||||
if (ret < 0)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -1099,7 +1099,7 @@ get_public_key (app_t app, int keyno)
|
||||
free (command);
|
||||
if (!fp)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error ("running gpg failed: %s\n", gpg_strerror (err));
|
||||
goto leave;
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ get_public_key (app_t app, int keyno)
|
||||
keybuf = xtrymalloc (50 + 2*35 + mlen + elen + 1);
|
||||
if (!keybuf)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
|
||||
@ -1260,7 +1260,7 @@ do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen)
|
||||
*pk = xtrymalloc (*pklen);
|
||||
if (!*pk)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
*pklen = 0;
|
||||
return err;
|
||||
}
|
||||
@ -1819,7 +1819,7 @@ do_writekey (app_t app, ctrl_t ctrl,
|
||||
template = tp = xtrymalloc_secure (template_len);
|
||||
if (!template)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
*tp++ = 0xC0;
|
||||
@ -2185,7 +2185,7 @@ do_sign (app_t app, const char *keyidstr, int hashalgo,
|
||||
|
||||
prompt = malloc (strlen (PROMPTSTRING) + 50);
|
||||
if (!prompt)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
sprintf (prompt, PROMPTSTRING, sigcount);
|
||||
rc = pincb (pincb_arg, prompt, &pinvalue);
|
||||
free (prompt);
|
||||
|
@ -520,7 +520,7 @@ parse_certid (app_t app, const char *certid,
|
||||
objidlen /= 2;
|
||||
objid = xtrymalloc (objidlen);
|
||||
if (!objid)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
for (s=certid, i=0; i < objidlen; i++, s+=2)
|
||||
objid[i] = xtoi_2 (s);
|
||||
*r_objid = objid;
|
||||
@ -1130,14 +1130,14 @@ read_ef_prkdf (app_t app, unsigned short fid, prkdf_object_t *result)
|
||||
+ objlen/2 * sizeof(unsigned short)));
|
||||
if (!prkdf)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
prkdf->objidlen = objidlen;
|
||||
prkdf->objid = xtrymalloc (objidlen);
|
||||
if (!prkdf->objid)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (prkdf);
|
||||
goto leave;
|
||||
}
|
||||
@ -1148,7 +1148,7 @@ read_ef_prkdf (app_t app, unsigned short fid, prkdf_object_t *result)
|
||||
prkdf->authid = xtrymalloc (authidlen);
|
||||
if (!prkdf->authid)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (prkdf->objid);
|
||||
xfree (prkdf);
|
||||
goto leave;
|
||||
@ -1416,14 +1416,14 @@ read_ef_cdf (app_t app, unsigned short fid, cdf_object_t *result)
|
||||
+ objlen/2 * sizeof(unsigned short)));
|
||||
if (!cdf)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
cdf->objidlen = objidlen;
|
||||
cdf->objid = xtrymalloc (objidlen);
|
||||
if (!cdf->objid)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (cdf);
|
||||
goto leave;
|
||||
}
|
||||
@ -2135,7 +2135,7 @@ read_ef_aodf (app_t app, unsigned short fid, aodf_object_t *result)
|
||||
continue; /* Ready. */
|
||||
|
||||
no_core:
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
release_aodf_object (aodf);
|
||||
goto leave;
|
||||
|
||||
@ -2272,7 +2272,7 @@ read_ef_tokeninfo (app_t app)
|
||||
app->app_local->serialno = xtrymalloc (objlen);
|
||||
if (!app->app_local->serialno)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
memcpy (app->app_local->serialno, p, objlen);
|
||||
@ -2368,7 +2368,7 @@ send_certinfo (app_t app, ctrl_t ctrl, const char *certtype,
|
||||
|
||||
buf = xtrymalloc (9 + certinfo->objidlen*2 + 1);
|
||||
if (!buf)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
p = stpcpy (buf, "P15");
|
||||
if (app->app_local->home_df)
|
||||
{
|
||||
@ -2463,7 +2463,7 @@ send_keypairinfo (app_t app, ctrl_t ctrl, prkdf_object_t keyinfo)
|
||||
|
||||
buf = xtrymalloc (9 + keyinfo->objidlen*2 + 1);
|
||||
if (!buf)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
p = stpcpy (buf, "P15");
|
||||
if (app->app_local->home_df)
|
||||
{
|
||||
@ -2544,7 +2544,7 @@ readcert_by_cdf (app_t app, cdf_object_t cdf,
|
||||
{
|
||||
*r_cert = xtrymalloc (cdf->imagelen);
|
||||
if (!*r_cert)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
memcpy (*r_cert, cdf->image, cdf->imagelen);
|
||||
*r_certlen = cdf->imagelen;
|
||||
return 0;
|
||||
@ -2687,7 +2687,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name)
|
||||
{
|
||||
buf = xtrymalloc (9 + prkdf->objidlen*2 + 1);
|
||||
if (!buf)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
p = stpcpy (buf, "P15");
|
||||
if (app->app_local->home_df)
|
||||
{
|
||||
@ -3059,7 +3059,7 @@ do_sign (app_t app, const char *keyidstr, int hashalgo,
|
||||
paddedpin = xtrymalloc (aodf->stored_length+1);
|
||||
if (!paddedpin)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (pinvalue);
|
||||
return err;
|
||||
}
|
||||
@ -3087,7 +3087,7 @@ do_sign (app_t app, const char *keyidstr, int hashalgo,
|
||||
paddedpin = xtrymalloc (aodf->stored_length+1);
|
||||
if (!paddedpin)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
xfree (pinvalue);
|
||||
return err;
|
||||
}
|
||||
@ -3345,7 +3345,7 @@ app_select_p15 (app_t app)
|
||||
app->app_local = xtrycalloc (1, sizeof *app->app_local);
|
||||
if (!app->app_local)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ lock_reader (int slot)
|
||||
{
|
||||
if (!pth_mutex_init (&lock_table[slot].lock))
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error ("error initializing mutex: %s\n", strerror (errno));
|
||||
return err;
|
||||
}
|
||||
@ -80,7 +80,7 @@ lock_reader (int slot)
|
||||
|
||||
if (!pth_mutex_acquire (&lock_table[slot].lock, 0, NULL))
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error ("failed to acquire APP lock for slot %d: %s\n",
|
||||
slot, strerror (errno));
|
||||
return err;
|
||||
@ -278,7 +278,7 @@ select_application (ctrl_t ctrl, int slot, const char *name, app_t *r_app)
|
||||
app = xtrycalloc (1, sizeof *app);
|
||||
if (!app)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_info ("error allocating context: %s\n", gpg_strerror (err));
|
||||
unlock_reader (slot);
|
||||
return err;
|
||||
@ -480,7 +480,7 @@ app_get_serial_and_stamp (app_t app, char **serial, time_t *stamp)
|
||||
|
||||
buf = xtrymalloc (app->serialnolen * 2 + 1);
|
||||
if (!buf)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
for (p=buf, i=0; i < app->serialnolen; p +=2, i++)
|
||||
sprintf (p, "%02X", app->serialno[i]);
|
||||
*p = 0;
|
||||
|
@ -1504,7 +1504,7 @@ cmd_apdu (assuan_context_t ctx, char *line)
|
||||
apdu = hex_to_buffer (line, &apdulen);
|
||||
if (!apdu)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
goto leave;
|
||||
}
|
||||
if (apdulen)
|
||||
@ -1603,7 +1603,7 @@ scd_command_handler (int fd)
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = assuan_init_connected_socket_server (&ctx, fd);
|
||||
rc = assuan_init_socket_server_ext (&ctx, fd, 2);
|
||||
}
|
||||
if (rc)
|
||||
{
|
||||
|
@ -677,7 +677,7 @@ iso7816_read_binary (int slot, size_t offset, size_t nmax,
|
||||
unsigned char *p = xtryrealloc (*result, *resultlen + bufferlen);
|
||||
if (!p)
|
||||
{
|
||||
gpg_error_t err = gpg_error_from_errno (errno);
|
||||
gpg_error_t err = gpg_error_from_syserror ();
|
||||
xfree (buffer);
|
||||
xfree (*result);
|
||||
*result = NULL;
|
||||
|
@ -1,3 +1,8 @@
|
||||
2006-09-14 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
2006-09-13 Werner Koch <wk@g10code.com>
|
||||
|
||||
* keylist.c (list_internal_keys): Print marker line to FP and not
|
||||
|
@ -451,7 +451,7 @@ base64_writer_cb (void *cb_value, const void *buffer, size_t count)
|
||||
parm->base64.idx = idx;
|
||||
parm->base64.quad_count = quad_count;
|
||||
|
||||
return ferror (fp) ? gpg_error_from_errno (errno) : 0;
|
||||
return ferror (fp) ? gpg_error_from_syserror () : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -351,7 +351,7 @@ find_up_external (KEYDB_HANDLE kh, const char *issuer, ksba_sexp_t keyid)
|
||||
|
||||
pattern = xtrymalloc (strlen (s)+2);
|
||||
if (!pattern)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
strcpy (stpcpy (pattern, "/"), s);
|
||||
add_to_strlist (&names, pattern);
|
||||
xfree (pattern);
|
||||
|
@ -117,7 +117,7 @@ insert_duptable (duptable_t *table, unsigned char *fpr, int *exists)
|
||||
/* Insert that fingerprint. */
|
||||
t = xtrymalloc (sizeof *t);
|
||||
if (!t)
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
memcpy (t->fpr, fpr+1, 19);
|
||||
t->next = table[idx];
|
||||
table[idx] = t;
|
||||
@ -558,14 +558,14 @@ export_p12 (ctrl_t ctrl, const unsigned char *certimg, size_t certimglen,
|
||||
infp = tmpfile ();
|
||||
if (!infp)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating temporary file: %s\n"), strerror (errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (fwrite (certimg, certimglen, 1, infp) != 1)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error writing to temporary file: %s\n"),
|
||||
strerror (errno));
|
||||
goto cleanup;
|
||||
@ -574,7 +574,7 @@ export_p12 (ctrl_t ctrl, const unsigned char *certimg, size_t certimglen,
|
||||
outfp = tmpfile ();
|
||||
if (!outfp)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating temporary file: %s\n"), strerror (errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -521,7 +521,7 @@ parse_p12 (ctrl_t ctrl, ksba_reader_t reader,
|
||||
tmpfp = tmpfile ();
|
||||
if (!tmpfp)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating temporary file: %s\n"), strerror (errno));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -529,7 +529,7 @@ parse_p12 (ctrl_t ctrl, ksba_reader_t reader,
|
||||
{
|
||||
if (nread && fwrite (buffer, nread, 1, tmpfp) != 1)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error writing to temporary file: %s\n"),
|
||||
strerror (errno));
|
||||
goto cleanup;
|
||||
@ -546,7 +546,7 @@ parse_p12 (ctrl_t ctrl, ksba_reader_t reader,
|
||||
certfp = tmpfile ();
|
||||
if (!certfp)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("error creating temporary file: %s\n"), strerror (errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -1164,7 +1164,7 @@ list_internal_keys (ctrl_t ctrl, STRLIST names, FILE *fp,
|
||||
desc = xtrycalloc (ndesc, sizeof *desc);
|
||||
if (!ndesc)
|
||||
{
|
||||
rc = gpg_error_from_errno (errno);
|
||||
rc = gpg_error_from_syserror ();
|
||||
log_error ("out of core\n");
|
||||
goto leave;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ read_list (char *key, char *country, int *lnr)
|
||||
listfp = fopen (listname, "r");
|
||||
if (!listfp && errno != ENOENT)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
log_error (_("can't open `%s': %s\n"), listname, gpg_strerror (err));
|
||||
return err;
|
||||
}
|
||||
@ -85,7 +85,7 @@ read_list (char *key, char *country, int *lnr)
|
||||
{
|
||||
if (feof (listfp))
|
||||
return gpg_error (GPG_ERR_EOF);
|
||||
return gpg_error_from_errno (errno);
|
||||
return gpg_error_from_syserror ();
|
||||
}
|
||||
|
||||
if (!*line || line[strlen(line)-1] != '\n')
|
||||
@ -234,7 +234,7 @@ gpgsm_qualified_consent (ctrl_t ctrl, ksba_cert_t cert)
|
||||
"to create or verify such signatures.\n"),
|
||||
opt.qualsig_approval? "":"\n"
|
||||
) < 0 )
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
|
||||
@ -251,7 +251,7 @@ gpgsm_qualified_consent (ctrl_t ctrl, ksba_cert_t cert)
|
||||
buffer = p = xtrymalloc (strlen (name) * 3 + 1);
|
||||
if (!buffer)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
free (name);
|
||||
return err;
|
||||
}
|
||||
@ -324,7 +324,7 @@ gpgsm_not_qualified_warning (ctrl_t ctrl, ksba_cert_t cert)
|
||||
"Note, that this certificate will NOT create a "
|
||||
"qualified signature!"),
|
||||
subject? subject:"?") < 0 )
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
else
|
||||
err = 0;
|
||||
|
||||
@ -341,7 +341,7 @@ gpgsm_not_qualified_warning (ctrl_t ctrl, ksba_cert_t cert)
|
||||
buffer = p = xtrymalloc (strlen (name) * 3 + 1);
|
||||
if (!buffer)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
free (name);
|
||||
return err;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
2006-09-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
Replaced all call gpg_error_from_errno(errno) by
|
||||
gpg_error_from_syserror().
|
||||
|
||||
* gpg-connect-agent.c (read_and_print_response): With verbosity
|
||||
level 2 also print comment lines.
|
||||
|
||||
|
@ -85,7 +85,7 @@ retrieve_key_material (FILE *fp, const char *hexkeyid, int *algorithm_id,
|
||||
break; /* EOF. */
|
||||
if (i < 0)
|
||||
{
|
||||
err = gpg_error_from_errno (errno);
|
||||
err = gpg_error_from_syserror ();
|
||||
goto leave; /* Error. */
|
||||
}
|
||||
if (!max_length)
|
||||
|
Loading…
x
Reference in New Issue
Block a user