mirror of git://git.gnupg.org/gnupg.git
First steps towards the W32CE port
This commit is contained in:
parent
30a4096fbb
commit
d232fd2e54
|
@ -1,3 +1,33 @@
|
||||||
|
2010-03-02 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* estream.c, estream.h, estream-printf.c, estream-printf.h: Update
|
||||||
|
from libestream.
|
||||||
|
|
||||||
|
2010-03-01 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* signal.c [!HAVE_SIGNAL_H]: Don't include signal.h.
|
||||||
|
|
||||||
|
* iobuf.c (direct_open) [W32CE]: Make filename to wchar_t.
|
||||||
|
(iobuf_cancel) [W32CE]: Use DeleteFile.
|
||||||
|
|
||||||
|
* gettime.c (dump_isotime): Use "%s" to print "none".
|
||||||
|
|
||||||
|
* homedir.c (standard_homedir) [W32CE]: Use wchar_t to create the
|
||||||
|
directory.
|
||||||
|
(w32_rootdir) [W32CE]: Likewise.
|
||||||
|
|
||||||
|
* sysutils.c (translate_sys2libc_fd) [W32CE]: Add support.
|
||||||
|
(gnupg_tmpfile) [W32CE]: Ditto.
|
||||||
|
(_gnupg_getenv) [W32CE]: New.
|
||||||
|
|
||||||
|
* util.h (getpid, getenv) [W32CE]: New.
|
||||||
|
|
||||||
|
* i18n.c (i18n_switchto_utf8)
|
||||||
|
(i18n_switchback) [USE_SIMPLE_GETTEXT]: Use new function from
|
||||||
|
libgpg-error which supports proper restoring.
|
||||||
|
|
||||||
|
* sysutils.c (get_session_marker): Simplified by using gcrypt.
|
||||||
|
|
||||||
2009-12-08 Marcus Brinkmann <marcus@g10code.de>
|
2009-12-08 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* Makefile.am (audit-events.h, status.h) [!MAINTAINER_MODE]: No
|
* Makefile.am (audit-events.h, status.h) [!MAINTAINER_MODE]: No
|
||||||
|
@ -266,7 +296,7 @@
|
||||||
|
|
||||||
* percent.c, t-percent.c: New.
|
* percent.c, t-percent.c: New.
|
||||||
|
|
||||||
* exechelp.c (gnupg_spawn_process, gnupg_spawn_process_fd)
|
* exechelp.c (gnupg_spawn_process, gnupg_spawn_process_fd)
|
||||||
(gnupg_spawn_process_detached) [W32]: Remove debug output.
|
(gnupg_spawn_process_detached) [W32]: Remove debug output.
|
||||||
|
|
||||||
2008-11-20 Werner Koch <wk@g10code.com>
|
2008-11-20 Werner Koch <wk@g10code.com>
|
||||||
|
@ -481,7 +511,7 @@
|
||||||
|
|
||||||
2007-11-05 Werner Koch <wk@g10code.com>
|
2007-11-05 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* audit.c, audit.h: New.
|
* audit.c, audit.h: New.
|
||||||
* Makefile.am: Add rules to build audit-events.h.
|
* Makefile.am: Add rules to build audit-events.h.
|
||||||
* exaudit.awk: New.
|
* exaudit.awk: New.
|
||||||
* mkstrtable.awk: New. Taken from libgpg-error.
|
* mkstrtable.awk: New. Taken from libgpg-error.
|
||||||
|
@ -506,7 +536,7 @@
|
||||||
(gnupg_create_inbound_pipe): New.
|
(gnupg_create_inbound_pipe): New.
|
||||||
* util.h (GNUPG_MODULE_NAME_GPGSM, GNUPG_MODULE_NAME_GPG): New.
|
* util.h (GNUPG_MODULE_NAME_GPGSM, GNUPG_MODULE_NAME_GPG): New.
|
||||||
* homedir.c (gnupg_module_name): Add them
|
* homedir.c (gnupg_module_name): Add them
|
||||||
|
|
||||||
2007-08-28 Werner Koch <wk@g10code.com>
|
2007-08-28 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gettime.c (check_isotime, add_isotime): New. Originally written
|
* gettime.c (check_isotime, add_isotime): New. Originally written
|
||||||
|
@ -527,7 +557,7 @@
|
||||||
2007-08-22 Werner Koch <wk@g10code.com>
|
2007-08-22 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
Updated estream from libestream.
|
Updated estream from libestream.
|
||||||
|
|
||||||
* estream.c (mem_malloc, mem_realloc, mem_free): New. Use them
|
* estream.c (mem_malloc, mem_realloc, mem_free): New. Use them
|
||||||
instead of the ES_MEM_foo.
|
instead of the ES_MEM_foo.
|
||||||
* estream.c (estream_cookie_mem): Remove members DONT_FREE,
|
* estream.c (estream_cookie_mem): Remove members DONT_FREE,
|
||||||
|
@ -596,7 +626,7 @@
|
||||||
|
|
||||||
2007-07-05 Werner Koch <wk@g10code.com>
|
2007-07-05 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* t-gettime.c: New.
|
* t-gettime.c: New.
|
||||||
* gettime.c (isotime2epoch, epoch2isotime): New.
|
* gettime.c (isotime2epoch, epoch2isotime): New.
|
||||||
|
|
||||||
2007-07-04 Werner Koch <wk@g10code.com>
|
2007-07-04 Werner Koch <wk@g10code.com>
|
||||||
|
@ -628,7 +658,7 @@
|
||||||
(iobuf_translate_file_handle): Remove.
|
(iobuf_translate_file_handle): Remove.
|
||||||
(translate_file_handle): Use new function.
|
(translate_file_handle): Use new function.
|
||||||
|
|
||||||
* estream-printf.c [TEST]: Header including fixes.
|
* estream-printf.c [TEST]: Header including fixes.
|
||||||
(do_format): Do not append a trailing Nul. This avoids spurious
|
(do_format): Do not append a trailing Nul. This avoids spurious
|
||||||
Nuls in the es_printf output.
|
Nuls in the es_printf output.
|
||||||
(estream_vsnprintf, estream_vasprintf): Take this in account.
|
(estream_vsnprintf, estream_vasprintf): Take this in account.
|
||||||
|
@ -642,11 +672,11 @@
|
||||||
(es_convert_mode): Set O_BINARY.
|
(es_convert_mode): Set O_BINARY.
|
||||||
(es_func_fd_create, es_func_fp_create, es_func_file_create) [W32]:
|
(es_func_fd_create, es_func_fp_create, es_func_file_create) [W32]:
|
||||||
Call setmode if requested.
|
Call setmode if requested.
|
||||||
|
|
||||||
2007-06-24 Werner Koch <wk@g10code.com>
|
2007-06-24 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* estream.c (do_fpopen, es_fpopen, es_fpopen_nc): New.
|
* estream.c (do_fpopen, es_fpopen, es_fpopen_nc): New.
|
||||||
(es_func_fp_create, es_func_fp_read, es_func_fp_write)
|
(es_func_fp_create, es_func_fp_read, es_func_fp_write)
|
||||||
(es_func_fp_seek, es_func_fp_destroy): New.
|
(es_func_fp_seek, es_func_fp_destroy): New.
|
||||||
|
|
||||||
2007-06-22 Werner Koch <wk@g10code.com>
|
2007-06-22 Werner Koch <wk@g10code.com>
|
||||||
|
@ -654,7 +684,7 @@
|
||||||
* estream.c (es_fdopen): Factored code out to..
|
* estream.c (es_fdopen): Factored code out to..
|
||||||
(do_fdopen): .. new.
|
(do_fdopen): .. new.
|
||||||
(es_fdopen_nc): New.
|
(es_fdopen_nc): New.
|
||||||
(estream_cookie_fd): Add field NO_CLOSE.
|
(estream_cookie_fd): Add field NO_CLOSE.
|
||||||
(es_func_fd_create): Add arg NO_CLOSE and changed all callers.
|
(es_func_fd_create): Add arg NO_CLOSE and changed all callers.
|
||||||
(es_func_fd_destroy): Handle the new flag.
|
(es_func_fd_destroy): Handle the new flag.
|
||||||
|
|
||||||
|
@ -696,8 +726,8 @@
|
||||||
(agent_open): Use it if GPG_AGENT_INFO is not set.
|
(agent_open): Use it if GPG_AGENT_INFO is not set.
|
||||||
(simple_pwquery): Extended to allow returning of otehyr error codes.
|
(simple_pwquery): Extended to allow returning of otehyr error codes.
|
||||||
|
|
||||||
* util.h (GNUPG_MODULE_NAME_AGENT, GNUPG_MODULE_NAME_PINENTRY)
|
* util.h (GNUPG_MODULE_NAME_AGENT, GNUPG_MODULE_NAME_PINENTRY)
|
||||||
(GNUPG_MODULE_NAME_SCDAEMON, GNUPG_MODULE_NAME_DIRMNGR)
|
(GNUPG_MODULE_NAME_SCDAEMON, GNUPG_MODULE_NAME_DIRMNGR)
|
||||||
(GNUPG_MODULE_NAME_PROTECT_TOOL): New.
|
(GNUPG_MODULE_NAME_PROTECT_TOOL): New.
|
||||||
* homedir.c (gnupg_module_name): New.
|
* homedir.c (gnupg_module_name): New.
|
||||||
(gnupg_bindir): New.
|
(gnupg_bindir): New.
|
||||||
|
@ -778,7 +808,7 @@
|
||||||
2007-05-07 Werner Koch <wk@g10code.com>
|
2007-05-07 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* signal.c (got_fatal_signal): Protect SIG from being clobbered by
|
* signal.c (got_fatal_signal): Protect SIG from being clobbered by
|
||||||
a faulty signal implementaion. Suggested by James Juran.
|
a faulty signal implementaion. Suggested by James Juran.
|
||||||
|
|
||||||
2007-04-25 Werner Koch <wk@g10code.com>
|
2007-04-25 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
@ -854,9 +884,9 @@
|
||||||
|
|
||||||
2006-10-17 Werner Koch <wk@g10code.com>
|
2006-10-17 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* estream.c (struct estream_internal, es_initialize)
|
* estream.c (struct estream_internal, es_initialize)
|
||||||
(es_deinitialize, print_fun_writer, es_print): New and modified
|
(es_deinitialize, print_fun_writer, es_print): New and modified
|
||||||
functions to avoid tempfiles for printf style printing.
|
functions to avoid tempfiles for printf style printing.
|
||||||
|
|
||||||
* Makefile.am (libcommonpth_a_SOURCES): New. We now build a secon
|
* Makefile.am (libcommonpth_a_SOURCES): New. We now build a secon
|
||||||
version of the library with explicit Pth support.
|
version of the library with explicit Pth support.
|
||||||
|
@ -899,7 +929,7 @@
|
||||||
buffer.
|
buffer.
|
||||||
|
|
||||||
2006-09-27 Florian Weimer <fweimer@bfk.de> (wk)
|
2006-09-27 Florian Weimer <fweimer@bfk.de> (wk)
|
||||||
|
|
||||||
* iobuf.c (iobuf_unread): New.
|
* iobuf.c (iobuf_unread): New.
|
||||||
|
|
||||||
2006-09-22 Werner Koch <wk@g10code.com>
|
2006-09-22 Werner Koch <wk@g10code.com>
|
||||||
|
@ -1086,7 +1116,7 @@
|
||||||
* estream.c (estream_cookie_mem): Make MEMORY unsigned char*.
|
* estream.c (estream_cookie_mem): Make MEMORY unsigned char*.
|
||||||
(es_write): Make BUFFER a void *.
|
(es_write): Make BUFFER a void *.
|
||||||
(es_writen): Ditto.
|
(es_writen): Ditto.
|
||||||
(es_func_fd_read, es_func_fd_write, es_func_mem_read)
|
(es_func_fd_read, es_func_fd_write, es_func_mem_read)
|
||||||
(es_func_mem_write): Ditto.
|
(es_func_mem_write): Ditto.
|
||||||
(es_read, es_readn): Ditto.
|
(es_read, es_readn): Ditto.
|
||||||
(es_func_mem_write): Made MEMORY_NEW an unsigned char *.
|
(es_func_mem_write): Made MEMORY_NEW an unsigned char *.
|
||||||
|
@ -1097,7 +1127,7 @@
|
||||||
|
|
||||||
* estream.c: Use HAVE_CONFIG_H and not USE_CONFIG_H!
|
* estream.c: Use HAVE_CONFIG_H and not USE_CONFIG_H!
|
||||||
(es_func_fd_read, es_func_fd_write): Protect against EINTR.
|
(es_func_fd_read, es_func_fd_write): Protect against EINTR.
|
||||||
|
|
||||||
2005-06-01 Werner Koch <wk@g10code.com>
|
2005-06-01 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* Makefile.am (AM_CPPFLAGS): Added.
|
* Makefile.am (AM_CPPFLAGS): Added.
|
||||||
|
@ -1169,7 +1199,7 @@
|
||||||
|
|
||||||
* signal.c (got_fatal_signal, got_usr_signal)
|
* signal.c (got_fatal_signal, got_usr_signal)
|
||||||
(got_fatal_signal) [DOSISH]: Don't build.
|
(got_fatal_signal) [DOSISH]: Don't build.
|
||||||
* simple-gettext.c: Include sysutils.h
|
* simple-gettext.c: Include sysutils.h
|
||||||
|
|
||||||
* homedir.c: New. Use CSIDL_APPDATA for W32 as the default home
|
* homedir.c: New. Use CSIDL_APPDATA for W32 as the default home
|
||||||
directory.
|
directory.
|
||||||
|
@ -1363,10 +1393,10 @@
|
||||||
2003-08-14 Timo Schulz <twoaday@freakmail.de>
|
2003-08-14 Timo Schulz <twoaday@freakmail.de>
|
||||||
|
|
||||||
* dynload.h. New. W32 wrapper around the dynload mechanism.
|
* dynload.h. New. W32 wrapper around the dynload mechanism.
|
||||||
|
|
||||||
2003-07-15 Werner Koch <wk@gnupg.org>
|
2003-07-15 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* simple-pwquery.c, simple-pwquery.h: New; moved from ../agent.
|
* simple-pwquery.c, simple-pwquery.h: New; moved from ../agent.
|
||||||
* Makefile.am (libsimple_pwquery_a_LIBADD): New.
|
* Makefile.am (libsimple_pwquery_a_LIBADD): New.
|
||||||
|
|
||||||
2003-06-25 Werner Koch <wk@gnupg.org>
|
2003-06-25 Werner Koch <wk@gnupg.org>
|
||||||
|
@ -1540,10 +1570,10 @@
|
||||||
* sysutils.c: New. This is the misc.c file from gnupg 1.0.6 with
|
* sysutils.c: New. This is the misc.c file from gnupg 1.0.6 with
|
||||||
the OpenPGP stuff removed.
|
the OpenPGP stuff removed.
|
||||||
* sysutils.h: New.
|
* sysutils.h: New.
|
||||||
|
|
||||||
2002-01-15 Werner Koch <wk@gnupg.org>
|
2002-01-15 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
* maperror.c: Add mapping for Not_Trusted.
|
* maperror.c: Add mapping for Not_Trusted.
|
||||||
|
|
||||||
2002-01-11 Werner Koch <wk@gnupg.org>
|
2002-01-11 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
@ -1570,10 +1600,10 @@
|
||||||
|
|
||||||
* util.h (digitp, hexdigitp): New ctype like macros.
|
* util.h (digitp, hexdigitp): New ctype like macros.
|
||||||
(atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New.
|
(atoi_1,atoi_2,atoi_4,xtoi_1,xtoi_2): New.
|
||||||
|
|
||||||
|
|
||||||
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
||||||
2008, 2009 Free Software Foundation, Inc.
|
2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is free software; as a special exception the author gives
|
This file is free software; as a special exception the author gives
|
||||||
unlimited permission to copy and/or distribute it, with or without
|
unlimited permission to copy and/or distribute it, with or without
|
||||||
|
@ -1582,5 +1612,3 @@
|
||||||
This file is distributed in the hope that it will be useful, but
|
This file is distributed in the hope that it will be useful, but
|
||||||
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ do_bin2hex (const void *buffer, size_t length, char *stringbuf, int with_colon)
|
||||||
size_t nbytes = n * length + 1;
|
size_t nbytes = n * length + 1;
|
||||||
if (length && (nbytes-1) / n != length)
|
if (length && (nbytes-1) / n != length)
|
||||||
{
|
{
|
||||||
errno = ENOMEM;
|
gpg_err_set_errno (ENOMEM);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
stringbuf = xtrymalloc (nbytes);
|
stringbuf = xtrymalloc (nbytes);
|
||||||
|
@ -232,7 +232,7 @@ hex2str_alloc (const char *hexstring, size_t *r_count)
|
||||||
{
|
{
|
||||||
if (r_count)
|
if (r_count)
|
||||||
*r_count = 0;
|
*r_count = 0;
|
||||||
errno = EINVAL;
|
gpg_err_set_errno (EINVAL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (r_count)
|
if (r_count)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* estream-printf.c - Versatile C-99 compliant printf formatting
|
/* estream-printf.c - Versatile mostly C-99 compliant printf formatting
|
||||||
* Copyright (C) 2007, 2008, 2009 g10 Code GmbH
|
* Copyright (C) 2007, 2008, 2009, 2010 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of Libestream.
|
* This file is part of Libestream.
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,40 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ALTERNATIVELY, Libestream may be distributed under the terms of the
|
||||||
|
* following license, in which case the provisions of this license are
|
||||||
|
* required INSTEAD OF the GNU General Public License. If you wish to
|
||||||
|
* allow use of your version of this file only under the terms of the
|
||||||
|
* GNU General Public License, and not to allow others to use your
|
||||||
|
* version of this file under the terms of the following license,
|
||||||
|
* indicate your decision by deleting this paragraph and the license
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, and the entire permission notice in its entirety,
|
||||||
|
* including the disclaimer of warranties.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Required autoconf tests:
|
/* Required autoconf tests:
|
||||||
|
@ -41,6 +75,13 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) && !defined(HAVE_W32_SYSTEM)
|
||||||
|
# define HAVE_W32_SYSTEM 1
|
||||||
|
# if defined(__MINGW32CE__) && !defined (HAVE_W32CE_SYSTEM)
|
||||||
|
# define HAVE_W32CE_SYSTEM
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -57,6 +98,9 @@
|
||||||
#ifdef HAVE_LANGINFO_THOUSANDS_SEP
|
#ifdef HAVE_LANGINFO_THOUSANDS_SEP
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
#include <gpg-error.h> /* ERRNO replacement. */
|
||||||
|
#endif
|
||||||
#ifdef _ESTREAM_PRINTF_EXTRA_INCLUDE
|
#ifdef _ESTREAM_PRINTF_EXTRA_INCLUDE
|
||||||
# include _ESTREAM_PRINTF_EXTRA_INCLUDE
|
# include _ESTREAM_PRINTF_EXTRA_INCLUDE
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,6 +121,13 @@
|
||||||
#define my_printf_free(a) free((a))
|
#define my_printf_free(a) free((a))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* A wrapper to set ERRNO. */
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
# define _set_errno(a) gpg_err_set_errno ((a))
|
||||||
|
#else
|
||||||
|
# define _set_errno(a) do { errno = (a); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Calculate array dimension. */
|
/* Calculate array dimension. */
|
||||||
#ifndef DIM
|
#ifndef DIM
|
||||||
|
@ -634,7 +685,7 @@ parse_format (const char *format,
|
||||||
return 0; /* Success. */
|
return 0; /* Success. */
|
||||||
|
|
||||||
leave_einval:
|
leave_einval:
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
leave:
|
leave:
|
||||||
if (argspecs != *argspecs_addr)
|
if (argspecs != *argspecs_addr)
|
||||||
free (argspecs);
|
free (argspecs);
|
||||||
|
@ -1540,7 +1591,7 @@ estream_format (estream_printf_out_t outfnc,
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
leave_einval:
|
leave_einval:
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
leave_error:
|
leave_error:
|
||||||
rc = -1;
|
rc = -1;
|
||||||
leave:
|
leave:
|
||||||
|
@ -1702,7 +1753,7 @@ dynamic_buffer_out (void *outfncarg, const char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
/* Just in case some formatting routine did not checked for an
|
/* Just in case some formatting routine did not checked for an
|
||||||
error. */
|
error. */
|
||||||
errno = parm->error_flag;
|
_set_errno (parm->error_flag);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1755,7 +1806,7 @@ estream_vasprintf (char **bufp, const char *format, va_list arg_ptr)
|
||||||
if (rc != -1 && parm.error_flag)
|
if (rc != -1 && parm.error_flag)
|
||||||
{
|
{
|
||||||
rc = -1;
|
rc = -1;
|
||||||
errno = parm.error_flag;
|
_set_errno (parm.error_flag);
|
||||||
}
|
}
|
||||||
if (rc == -1)
|
if (rc == -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* estream-printf.h - Versatile C-99 compliant printf formatting.
|
/* estream-printf.h - Versatile mostly C-99 compliant printf formatting.
|
||||||
* Copyright (C) 2007 g10 Code GmbH
|
* Copyright (C) 2007, 2010 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of Libestream.
|
* This file is part of Libestream.
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,40 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ALTERNATIVELY, Libestream may be distributed under the terms of the
|
||||||
|
* following license, in which case the provisions of this license are
|
||||||
|
* required INSTEAD OF the GNU General Public License. If you wish to
|
||||||
|
* allow use of your version of this file only under the terms of the
|
||||||
|
* GNU General Public License, and not to allow others to use your
|
||||||
|
* version of this file under the terms of the following license,
|
||||||
|
* indicate your decision by deleting this paragraph and the license
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, and the entire permission notice in its entirety,
|
||||||
|
* including the disclaimer of warranties.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ESTREAM_PRINTF_H
|
#ifndef ESTREAM_PRINTF_H
|
||||||
|
|
110
common/estream.c
110
common/estream.c
|
@ -1,5 +1,5 @@
|
||||||
/* estream.c - Extended Stream I/O Library
|
/* estream.c - Extended Stream I/O Library
|
||||||
* Copyright (C) 2004, 2005, 2006, 2007, 2009 g10 Code GmbH
|
* Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of Libestream.
|
* This file is part of Libestream.
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,40 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ALTERNATIVELY, Libestream may be distributed under the terms of the
|
||||||
|
* following license, in which case the provisions of this license are
|
||||||
|
* required INSTEAD OF the GNU General Public License. If you wish to
|
||||||
|
* allow use of your version of this file only under the terms of the
|
||||||
|
* GNU General Public License, and not to allow others to use your
|
||||||
|
* version of this file under the terms of the following license,
|
||||||
|
* indicate your decision by deleting this paragraph and the license
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, and the entire permission notice in its entirety,
|
||||||
|
* including the disclaimer of warranties.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef USE_ESTREAM_SUPPORT_H
|
#ifdef USE_ESTREAM_SUPPORT_H
|
||||||
|
@ -27,6 +61,9 @@
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(HAVE_W32_SYSTEM)
|
#if defined(_WIN32) && !defined(HAVE_W32_SYSTEM)
|
||||||
# define HAVE_W32_SYSTEM 1
|
# define HAVE_W32_SYSTEM 1
|
||||||
|
# if defined(__MINGW32CE__) && !defined (HAVE_W32CE_SYSTEM)
|
||||||
|
# define HAVE_W32CE_SYSTEM
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -44,6 +81,9 @@
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
# include <gpg-error.h> /* ERRNO replacement. */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
|
#ifdef WITHOUT_GNU_PTH /* Give the Makefile a chance to build without Pth. */
|
||||||
# undef HAVE_PTH
|
# undef HAVE_PTH
|
||||||
|
@ -76,6 +116,13 @@ void *memrchr (const void *block, int c, size_t size);
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
# define _set_errno(a) gpg_err_set_errno ((a))
|
||||||
|
#else
|
||||||
|
# define _set_errno(a) do { errno = (a); } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Generally used types. */
|
/* Generally used types. */
|
||||||
|
|
||||||
typedef void *(*func_realloc_t) (void *mem, size_t size);
|
typedef void *(*func_realloc_t) (void *mem, size_t size);
|
||||||
|
@ -427,7 +474,7 @@ es_func_mem_create (void *ES__RESTRICT *ES__RESTRICT cookie,
|
||||||
|
|
||||||
if (!data && (data_n || data_len))
|
if (!data && (data_n || data_len))
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +558,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
|
||||||
newsize = mem_cookie->memory_size + (nleft - size);
|
newsize = mem_cookie->memory_size + (nleft - size);
|
||||||
if (newsize < mem_cookie->offset)
|
if (newsize < mem_cookie->offset)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +569,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
|
||||||
newsize += mem_cookie->block_size - 1;
|
newsize += mem_cookie->block_size - 1;
|
||||||
if (newsize < mem_cookie->offset)
|
if (newsize < mem_cookie->offset)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
newsize /= mem_cookie->block_size;
|
newsize /= mem_cookie->block_size;
|
||||||
|
@ -532,7 +579,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
|
||||||
/* Check for a total limit. */
|
/* Check for a total limit. */
|
||||||
if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit)
|
if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit)
|
||||||
{
|
{
|
||||||
errno = ENOSPC;
|
_set_errno (ENOSPC);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +628,7 @@ es_func_mem_seek (void *cookie, off_t *offset, int whence)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,14 +639,14 @@ es_func_mem_seek (void *cookie, off_t *offset, int whence)
|
||||||
|
|
||||||
if (!mem_cookie->flags.grow)
|
if (!mem_cookie->flags.grow)
|
||||||
{
|
{
|
||||||
errno = ENOSPC;
|
_set_errno (ENOSPC);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
newsize = pos_new + mem_cookie->block_size - 1;
|
newsize = pos_new + mem_cookie->block_size - 1;
|
||||||
if (newsize < pos_new)
|
if (newsize < pos_new)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
newsize /= mem_cookie->block_size;
|
newsize /= mem_cookie->block_size;
|
||||||
|
@ -607,7 +654,7 @@ es_func_mem_seek (void *cookie, off_t *offset, int whence)
|
||||||
|
|
||||||
if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit)
|
if (mem_cookie->memory_limit && newsize > mem_cookie->memory_limit)
|
||||||
{
|
{
|
||||||
errno = ENOSPC;
|
_set_errno (ENOSPC);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,7 +1018,7 @@ es_convert_mode (const char *mode, unsigned int *modeflags)
|
||||||
oflags = O_APPEND | O_CREAT;
|
oflags = O_APPEND | O_CREAT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (mode++; *mode; mode++)
|
for (mode++; *mode; mode++)
|
||||||
|
@ -1010,7 +1057,7 @@ es_fill (estream_t stream)
|
||||||
|
|
||||||
if (!stream->intern->func_read)
|
if (!stream->intern->func_read)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
_set_errno (EOPNOTSUPP);
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1173,7 +1220,7 @@ es_deinitialize (estream_t stream)
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
fclose (stream->intern->print_fp);
|
fclose (stream->intern->print_fp);
|
||||||
stream->intern->print_fp = NULL;
|
stream->intern->print_fp = NULL;
|
||||||
errno = save_errno;
|
_set_errno (save_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
func_close = stream->intern->func_close;
|
func_close = stream->intern->func_close;
|
||||||
|
@ -1460,7 +1507,7 @@ es_seek (estream_t ES__RESTRICT stream, off_t offset, int whence,
|
||||||
|
|
||||||
if (! func_seek)
|
if (! func_seek)
|
||||||
{
|
{
|
||||||
errno = EOPNOTSUPP;
|
_set_errno (EOPNOTSUPP);
|
||||||
err = -1;
|
err = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1777,7 @@ es_skip (estream_t stream, size_t size)
|
||||||
|
|
||||||
if (stream->data_offset + size > stream->data_len)
|
if (stream->data_offset + size > stream->data_len)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2309,7 +2356,7 @@ es_freopen (const char *ES__RESTRICT path, const char *ES__RESTRICT mode,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* FIXME? We don't support re-opening at the moment. */
|
/* FIXME? We don't support re-opening at the moment. */
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
es_deinitialize (stream);
|
es_deinitialize (stream);
|
||||||
es_destroy (stream);
|
es_destroy (stream);
|
||||||
stream = NULL;
|
stream = NULL;
|
||||||
|
@ -2821,7 +2868,7 @@ es_read_line (estream_t stream,
|
||||||
{
|
{
|
||||||
/* This should never happen. If it does, the function has been
|
/* This should never happen. If it does, the function has been
|
||||||
called with wrong arguments. */
|
called with wrong arguments. */
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
length -= 3; /* Reserve 3 bytes for CR,LF,EOL. */
|
length -= 3; /* Reserve 3 bytes for CR,LF,EOL. */
|
||||||
|
@ -2855,7 +2902,7 @@ es_read_line (estream_t stream,
|
||||||
if (max_length)
|
if (max_length)
|
||||||
*max_length = 0;
|
*max_length = 0;
|
||||||
ESTREAM_UNLOCK (stream);
|
ESTREAM_UNLOCK (stream);
|
||||||
errno = save_errno;
|
_set_errno (save_errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
buffer = *addr_of_buffer;
|
buffer = *addr_of_buffer;
|
||||||
|
@ -2973,21 +3020,32 @@ tmpfd (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
int attempts, n;
|
int attempts, n;
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wchar_t buffer[MAX_PATH+9+12+1];
|
||||||
|
# define mystrlen(a) wcslen (a)
|
||||||
|
wchar_t *name, *p;
|
||||||
|
#else
|
||||||
char buffer[MAX_PATH+9+12+1];
|
char buffer[MAX_PATH+9+12+1];
|
||||||
|
# define mystrlen(a) strlen (a)
|
||||||
char *name, *p;
|
char *name, *p;
|
||||||
|
#endif
|
||||||
HANDLE file;
|
HANDLE file;
|
||||||
int pid = GetCurrentProcessId ();
|
int pid = GetCurrentProcessId ();
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
n = GetTempPath (MAX_PATH+1, buffer);
|
n = GetTempPath (MAX_PATH+1, buffer);
|
||||||
if (!n || n > MAX_PATH || strlen (buffer) > MAX_PATH)
|
if (!n || n > MAX_PATH || mystrlen (buffer) > MAX_PATH)
|
||||||
{
|
{
|
||||||
errno = ENOENT;
|
_set_errno (ENOENT);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
p = buffer + strlen (buffer);
|
p = buffer + mystrlen (buffer);
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wcscpy (p, L"_estream");
|
||||||
|
#else
|
||||||
strcpy (p, "_estream");
|
strcpy (p, "_estream");
|
||||||
|
#endif
|
||||||
p += 8;
|
p += 8;
|
||||||
/* We try to create the directory but don't care about an error as
|
/* We try to create the directory but don't care about an error as
|
||||||
it may already exist and the CreateFile would throw an error
|
it may already exist and the CreateFile would throw an error
|
||||||
|
@ -3004,7 +3062,11 @@ tmpfd (void)
|
||||||
*p++ = tohex (((value >> 28) & 0x0f));
|
*p++ = tohex (((value >> 28) & 0x0f));
|
||||||
value <<= 4;
|
value <<= 4;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wcscpy (p, L".tmp");
|
||||||
|
#else
|
||||||
strcpy (p, ".tmp");
|
strcpy (p, ".tmp");
|
||||||
|
#endif
|
||||||
file = CreateFile (buffer,
|
file = CreateFile (buffer,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
0,
|
0,
|
||||||
|
@ -3014,17 +3076,21 @@ tmpfd (void)
|
||||||
NULL);
|
NULL);
|
||||||
if (file != INVALID_HANDLE_VALUE)
|
if (file != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
int fd = (int)file;
|
||||||
|
#else
|
||||||
int fd = _open_osfhandle ((long)file, 0);
|
int fd = _open_osfhandle ((long)file, 0);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
CloseHandle (file);
|
CloseHandle (file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
Sleep (1); /* One ms as this is the granularity of GetTickCount. */
|
Sleep (1); /* One ms as this is the granularity of GetTickCount. */
|
||||||
}
|
}
|
||||||
errno = ENOENT;
|
_set_errno (ENOENT);
|
||||||
return -1;
|
return -1;
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -3109,7 +3175,7 @@ es_setvbuf (estream_t ES__RESTRICT stream,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
_set_errno (EINVAL);
|
||||||
err = -1;
|
err = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* estream.h - Extended stream I/O Library
|
/* estream.h - Extended stream I/O Library
|
||||||
* Copyright (C) 2004, 2005, 2006, 2007 g10 Code GmbH
|
* Copyright (C) 2004, 2005, 2006, 2007, 2010 g10 Code GmbH
|
||||||
*
|
*
|
||||||
* This file is part of Libestream.
|
* This file is part of Libestream.
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,40 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
* along with Libestream; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* ALTERNATIVELY, Libestream may be distributed under the terms of the
|
||||||
|
* following license, in which case the provisions of this license are
|
||||||
|
* required INSTEAD OF the GNU General Public License. If you wish to
|
||||||
|
* allow use of your version of this file only under the terms of the
|
||||||
|
* GNU General Public License, and not to allow others to use your
|
||||||
|
* version of this file under the terms of the following license,
|
||||||
|
* indicate your decision by deleting this paragraph and the license
|
||||||
|
* below.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, and the entire permission notice in its entirety,
|
||||||
|
* including the disclaimer of warranties.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
||||||
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ESTREAM_H
|
#ifndef ESTREAM_H
|
||||||
|
|
|
@ -500,7 +500,7 @@ void
|
||||||
dump_isotime (const gnupg_isotime_t t)
|
dump_isotime (const gnupg_isotime_t t)
|
||||||
{
|
{
|
||||||
if (!t || !*t)
|
if (!t || !*t)
|
||||||
log_printf (_("[none]"));
|
log_printf ("%s", _("[none]"));
|
||||||
else
|
else
|
||||||
log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
|
log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
|
||||||
t, t+4, t+6, t+9, t+11, t+13);
|
t, t+4, t+6, t+9, t+11, t+13);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* homedir.c - Setup the home directory.
|
/* homedir.c - Setup the home directory.
|
||||||
* Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
* Copyright (C) 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
|
@ -114,7 +114,18 @@ standard_homedir (void)
|
||||||
|
|
||||||
/* Try to create the directory if it does not yet exists. */
|
/* Try to create the directory if it does not yet exists. */
|
||||||
if (access (dir, F_OK))
|
if (access (dir, F_OK))
|
||||||
CreateDirectory (dir, NULL);
|
{
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wchar_t *wdir = utf8_to_wchar (dir);
|
||||||
|
if (wdir)
|
||||||
|
{
|
||||||
|
CreateDirectory (wdir, NULL);
|
||||||
|
xfree (wdir);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
CreateDirectory (dir, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dir = GNUPG_DEFAULT_HOMEDIR;
|
dir = GNUPG_DEFAULT_HOMEDIR;
|
||||||
|
@ -178,8 +189,20 @@ w32_rootdir (void)
|
||||||
if (!got_dir)
|
if (!got_dir)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if ( !GetModuleFileName ( NULL, dir, MAX_PATH) )
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
{
|
||||||
|
wchar_t wdir [MAX_PATH+5];
|
||||||
|
rc = GetModuleFileName (NULL, wdir, MAX_PATH);
|
||||||
|
if (rc && WideCharToMultiByte (CP_UTF8, 0, wdir, -1, dir, MAX_PATH-4,
|
||||||
|
NULL, NULL) < 0)
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
rc = GetModuleFileName (NULL, dir, MAX_PATH);
|
||||||
|
#endif
|
||||||
|
if (!rc)
|
||||||
{
|
{
|
||||||
log_debug ("GetModuleFileName failed: %s\n", w32_strerror (0));
|
log_debug ("GetModuleFileName failed: %s\n", w32_strerror (0));
|
||||||
*dir = 0;
|
*dir = 0;
|
||||||
|
|
|
@ -1225,7 +1225,7 @@ my_read_line (
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
xfree (buffer);
|
xfree (buffer);
|
||||||
*length_of_buffer = *max_length = 0;
|
*length_of_buffer = *max_length = 0;
|
||||||
errno = save_errno;
|
gpg_err_set_errno (save_errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
buffer = *addr_of_buffer;
|
buffer = *addr_of_buffer;
|
||||||
|
@ -1548,12 +1548,13 @@ connect_server (const char *server, unsigned short port,
|
||||||
int srv, connected;
|
int srv, connected;
|
||||||
int last_errno = 0;
|
int last_errno = 0;
|
||||||
struct srventry *serverlist = NULL;
|
struct srventry *serverlist = NULL;
|
||||||
|
#ifdef HAVE_W32_SYSTEM
|
||||||
|
unsigned long inaddr;
|
||||||
|
#endif
|
||||||
/* Not currently using the flags */
|
/* Not currently using the flags */
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
unsigned long inaddr;
|
|
||||||
|
|
||||||
#ifndef HTTP_NO_WSASTARTUP
|
#ifndef HTTP_NO_WSASTARTUP
|
||||||
init_sockets ();
|
init_sockets ();
|
||||||
|
@ -1724,7 +1725,7 @@ connect_server (const char *server, unsigned short port,
|
||||||
#endif
|
#endif
|
||||||
if (sock != -1)
|
if (sock != -1)
|
||||||
sock_close (sock);
|
sock_close (sock);
|
||||||
errno = last_errno;
|
gpg_err_set_errno (last_errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return sock;
|
return sock;
|
||||||
|
@ -1805,7 +1806,7 @@ cookie_read (void *cookie, void *buffer, size_t size)
|
||||||
if (nread == GNUTLS_E_REHANDSHAKE)
|
if (nread == GNUTLS_E_REHANDSHAKE)
|
||||||
goto again; /* A client is allowed to just ignore this request. */
|
goto again; /* A client is allowed to just ignore this request. */
|
||||||
log_info ("TLS network read failed: %s\n", gnutls_strerror (nread));
|
log_info ("TLS network read failed: %s\n", gnutls_strerror (nread));
|
||||||
errno = EIO;
|
gpg_err_set_errno (EIO);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1856,7 +1857,7 @@ cookie_write (void *cookie, const void *buffer, size_t size)
|
||||||
}
|
}
|
||||||
log_info ("TLS network write failed: %s\n",
|
log_info ("TLS network write failed: %s\n",
|
||||||
gnutls_strerror (nwritten));
|
gnutls_strerror (nwritten));
|
||||||
errno = EIO;
|
gpg_err_set_errno (EIO);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
nleft -= nwritten;
|
nleft -= nwritten;
|
||||||
|
@ -1868,7 +1869,7 @@ cookie_write (void *cookie, const void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
if ( write_server (c->fd, buffer, size) )
|
if ( write_server (c->fd, buffer, size) )
|
||||||
{
|
{
|
||||||
errno = EIO;
|
gpg_err_set_errno (EIO);
|
||||||
nwritten = -1;
|
nwritten = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* i18n.c - gettext initialization
|
/* i18n.c - gettext initialization
|
||||||
* Copyright (C) 2007 Free Software Foundation, Inc.
|
* Copyright (C) 2007, 2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This file is part of GnuPG.
|
* This file is part of GnuPG.
|
||||||
*
|
*
|
||||||
|
@ -51,8 +51,8 @@ char *
|
||||||
i18n_switchto_utf8 (void)
|
i18n_switchto_utf8 (void)
|
||||||
{
|
{
|
||||||
#ifdef USE_SIMPLE_GETTEXT
|
#ifdef USE_SIMPLE_GETTEXT
|
||||||
gettext_select_utf8 (1);
|
/* Return an arbitrary pointer as true value. */
|
||||||
return NULL;
|
return gettext_use_utf8 (1) ? (char*)(-1) : NULL;
|
||||||
#elif defined(ENABLE_NLS)
|
#elif defined(ENABLE_NLS)
|
||||||
char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
|
char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
|
||||||
# ifdef HAVE_LANGINFO_CODESET
|
# ifdef HAVE_LANGINFO_CODESET
|
||||||
|
@ -82,8 +82,7 @@ void
|
||||||
i18n_switchback (char *saved_codeset)
|
i18n_switchback (char *saved_codeset)
|
||||||
{
|
{
|
||||||
#ifdef USE_SIMPLE_GETTEXT
|
#ifdef USE_SIMPLE_GETTEXT
|
||||||
(void)saved_codeset;
|
gettext_use_utf8 (!!saved_codeset);
|
||||||
gettext_select_utf8 (0);
|
|
||||||
#elif defined(ENABLE_NLS)
|
#elif defined(ENABLE_NLS)
|
||||||
if (saved_codeset)
|
if (saved_codeset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,7 +306,21 @@ direct_open (const char *fname, const char *mode)
|
||||||
sm = FILE_SHARE_READ;
|
sm = FILE_SHARE_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
{
|
||||||
|
wchar_t *wfname = utf8_to_wchar (fname);
|
||||||
|
if (wfname)
|
||||||
|
{
|
||||||
|
hfile = CreateFile (wfname, da, sm, NULL, cd,
|
||||||
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
xfree (wfname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hfile = INVALID_HANDLE_VALUE;
|
||||||
|
}
|
||||||
|
#else
|
||||||
hfile = CreateFile (fname, da, sm, NULL, cd, FILE_ATTRIBUTE_NORMAL, NULL);
|
hfile = CreateFile (fname, da, sm, NULL, cd, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
#endif
|
||||||
return hfile;
|
return hfile;
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
int oflag;
|
int oflag;
|
||||||
|
@ -1188,7 +1202,14 @@ iobuf_cancel (iobuf_t a)
|
||||||
{
|
{
|
||||||
/* Argg, MSDOS does not allow to remove open files. So
|
/* Argg, MSDOS does not allow to remove open files. So
|
||||||
* we have to do it here */
|
* we have to do it here */
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wchar_t *wtmp = utf8_to_wchar (remove_name);
|
||||||
|
if (wtmp)
|
||||||
|
DeleteFile (wtmp);
|
||||||
|
xfree (wtmp);
|
||||||
|
#else
|
||||||
remove (remove_name);
|
remove (remove_name);
|
||||||
|
#endif
|
||||||
xfree (remove_name);
|
xfree (remove_name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -105,7 +105,7 @@ get_membuf (membuf_t *mb, size_t *len)
|
||||||
xfree (mb->buf);
|
xfree (mb->buf);
|
||||||
mb->buf = NULL;
|
mb->buf = NULL;
|
||||||
}
|
}
|
||||||
errno = mb->out_of_core;
|
gpg_err_set_errno (mb->out_of_core);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#ifdef HAVE_SIGNAL_H
|
||||||
|
# include <signal.h>
|
||||||
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -130,31 +130,20 @@ enable_core_dumps (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Return a string which is used as a kind of process ID */
|
/* Return a string which is used as a kind of process ID. */
|
||||||
const byte *
|
const byte *
|
||||||
get_session_marker( size_t *rlen )
|
get_session_marker (size_t *rlen)
|
||||||
{
|
{
|
||||||
static byte marker[SIZEOF_UNSIGNED_LONG*2];
|
static byte marker[SIZEOF_UNSIGNED_LONG*2];
|
||||||
static int initialized;
|
static int initialized;
|
||||||
|
|
||||||
if ( !initialized ) {
|
if (!initialized)
|
||||||
volatile ulong aa, bb; /* we really want the uninitialized value */
|
{
|
||||||
ulong a, b;
|
gcry_create_nonce (marker, sizeof marker);
|
||||||
|
initialized = 1;
|
||||||
initialized = 1;
|
|
||||||
/* Although this marker is guessable it is not easy to use
|
|
||||||
* for a faked control packet because an attacker does not
|
|
||||||
* have enough control about the time the verification does
|
|
||||||
* take place. Of course, we can add just more random but
|
|
||||||
* than we need the random generator even for verification
|
|
||||||
* tasks - which does not make sense. */
|
|
||||||
a = aa ^ (ulong)getpid();
|
|
||||||
b = bb ^ (ulong)time(NULL);
|
|
||||||
memcpy( marker, &a, SIZEOF_UNSIGNED_LONG );
|
|
||||||
memcpy( marker+SIZEOF_UNSIGNED_LONG, &b, SIZEOF_UNSIGNED_LONG );
|
|
||||||
}
|
}
|
||||||
*rlen = sizeof(marker);
|
*rlen = sizeof (marker);
|
||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,7 +275,10 @@ gnupg_sleep (unsigned int seconds)
|
||||||
int
|
int
|
||||||
translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
|
translate_sys2libc_fd (gnupg_fd_t fd, int for_write)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#if defined(HAVE_W32CE_SYSTEM)
|
||||||
|
(void)for_write;
|
||||||
|
return (int)fd;
|
||||||
|
#elif defined(HAVE_W32_SYSTEM)
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
if (fd == GNUPG_INVALID_FD)
|
if (fd == GNUPG_INVALID_FD)
|
||||||
|
@ -331,8 +323,15 @@ gnupg_tmpfile (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
int attempts, n;
|
int attempts, n;
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wchar_t buffer[MAX_PATH+7+12+1];
|
||||||
|
# define mystrlen(a) wcslen (a)
|
||||||
|
wchar_t *name, *p;
|
||||||
|
#else
|
||||||
char buffer[MAX_PATH+7+12+1];
|
char buffer[MAX_PATH+7+12+1];
|
||||||
|
# define mystrlen(a) strlen (a)
|
||||||
char *name, *p;
|
char *name, *p;
|
||||||
|
#endif
|
||||||
HANDLE file;
|
HANDLE file;
|
||||||
int pid = GetCurrentProcessId ();
|
int pid = GetCurrentProcessId ();
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
|
@ -344,13 +343,18 @@ gnupg_tmpfile (void)
|
||||||
sec_attr.bInheritHandle = TRUE;
|
sec_attr.bInheritHandle = TRUE;
|
||||||
|
|
||||||
n = GetTempPath (MAX_PATH+1, buffer);
|
n = GetTempPath (MAX_PATH+1, buffer);
|
||||||
if (!n || n > MAX_PATH || strlen (buffer) > MAX_PATH)
|
if (!n || n > MAX_PATH || mystrlen (buffer) > MAX_PATH)
|
||||||
{
|
{
|
||||||
errno = ENOENT;
|
gpg_err_set_errno (ENOENT);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
p = buffer + strlen (buffer);
|
p = buffer + mystrlen (buffer);
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wcscpy (p, L"_gnupg");
|
||||||
|
p += 7;
|
||||||
|
#else
|
||||||
p = stpcpy (p, "_gnupg");
|
p = stpcpy (p, "_gnupg");
|
||||||
|
#endif
|
||||||
/* We try to create the directory but don't care about an error as
|
/* We try to create the directory but don't care about an error as
|
||||||
it may already exist and the CreateFile would throw an error
|
it may already exist and the CreateFile would throw an error
|
||||||
anyway. */
|
anyway. */
|
||||||
|
@ -366,7 +370,11 @@ gnupg_tmpfile (void)
|
||||||
*p++ = tohex (((value >> 28) & 0x0f));
|
*p++ = tohex (((value >> 28) & 0x0f));
|
||||||
value <<= 4;
|
value <<= 4;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
wcscpy (p, L".tmp");
|
||||||
|
#else
|
||||||
strcpy (p, ".tmp");
|
strcpy (p, ".tmp");
|
||||||
|
#endif
|
||||||
file = CreateFile (buffer,
|
file = CreateFile (buffer,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
0,
|
0,
|
||||||
|
@ -377,6 +385,10 @@ gnupg_tmpfile (void)
|
||||||
if (file != INVALID_HANDLE_VALUE)
|
if (file != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
int fd = (int)file;
|
||||||
|
fp = _wfdopen (fd, L"w+b");
|
||||||
|
#else
|
||||||
int fd = _open_osfhandle ((long)file, 0);
|
int fd = _open_osfhandle ((long)file, 0);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
|
@ -384,19 +396,21 @@ gnupg_tmpfile (void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fp = fdopen (fd, "w+b");
|
fp = fdopen (fd, "w+b");
|
||||||
|
#endif
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
int save = errno;
|
int save = errno;
|
||||||
close (fd);
|
close (fd);
|
||||||
errno = save;
|
gpg_err_set_errno (save);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
Sleep (1); /* One ms as this is the granularity of GetTickCount. */
|
Sleep (1); /* One ms as this is the granularity of GetTickCount. */
|
||||||
}
|
}
|
||||||
errno = ENOENT;
|
gpg_err_set_errno (ENOENT);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#undef mystrlen
|
||||||
#else /*!HAVE_W32_SYSTEM*/
|
#else /*!HAVE_W32_SYSTEM*/
|
||||||
return tmpfile ();
|
return tmpfile ();
|
||||||
#endif /*!HAVE_W32_SYSTEM*/
|
#endif /*!HAVE_W32_SYSTEM*/
|
||||||
|
@ -490,3 +504,18 @@ gnupg_allow_set_foregound_window (pid_t pid)
|
||||||
(unsigned long)pid, w32_strerror (-1));
|
(unsigned long)pid, w32_strerror (-1));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
/* Replacement for getenv which takes care of the our use of getenv.
|
||||||
|
The code is not thread safe but we expect it to work in all cases
|
||||||
|
because it is called for the first time early enough. */
|
||||||
|
char *
|
||||||
|
_gnupg_getenv (const char *name)
|
||||||
|
{
|
||||||
|
(void)name;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /*HAVE_W32CE_SYSTEM*/
|
||||||
|
|
||||||
|
|
|
@ -300,6 +300,13 @@ ttyname (int fd)
|
||||||
}
|
}
|
||||||
#endif /* !HAVE_TTYNAME */
|
#endif /* !HAVE_TTYNAME */
|
||||||
|
|
||||||
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
|
#define getpid() GetCurrentProcessId ()
|
||||||
|
char *_gnupg_getenv (const char *name); /* See sysutils.c */
|
||||||
|
#define getenv(a) _gnupg_getenv ((a))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-- Macros to replace ctype ones to avoid locale problems. --*/
|
/*-- Macros to replace ctype ones to avoid locale problems. --*/
|
||||||
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
|
#define spacep(p) (*(p) == ' ' || *(p) == '\t')
|
||||||
|
|
|
@ -98,7 +98,7 @@ read_line (FILE *fp,
|
||||||
*length_of_buffer = 0;
|
*length_of_buffer = 0;
|
||||||
if (max_length)
|
if (max_length)
|
||||||
*max_length = 0;
|
*max_length = 0;
|
||||||
errno = save_errno;
|
gpg_err_set_errno (save_errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
buffer = *addr_of_buffer;
|
buffer = *addr_of_buffer;
|
||||||
|
|
|
@ -999,8 +999,8 @@ fi
|
||||||
#
|
#
|
||||||
AC_MSG_NOTICE([checking for header files])
|
AC_MSG_NOTICE([checking for header files])
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
|
AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
|
||||||
AC_CHECK_HEADERS([pty.h pwd.h inttypes.h])
|
pty.h pwd.h inttypes.h signal.h])
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue