[svn] assuan - r350 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Fri Jan 22 16:52:41 CET 2010
Author: wk
Date: 2010-01-22 16:52:40 +0100 (Fri, 22 Jan 2010)
New Revision: 350
Modified:
trunk/ChangeLog
trunk/NEWS
trunk/autogen.sh
trunk/configure.ac
trunk/ltmain.sh
trunk/src/ChangeLog
trunk/src/assuan-buffer.c
trunk/src/assuan-handler.c
trunk/src/assuan-logging.c
trunk/src/assuan-socket.c
trunk/src/assuan-uds.c
trunk/src/debug.c
trunk/src/system.c
Log:
Prepare for a port to WindowsCE.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/ChangeLog 2010-01-22 15:52:40 UTC (rev 350)
@@ -1,3 +1,15 @@
+2010-01-22 Werner Koch <wk at g10code.com>
+
+ * (libtool):
+
+ * configure.ac: Require libgpg-error 1.8.
+ (HAVE_W32CE_SYSTEM): New am_defines and am_conditionals.
+
+ * ltmain.sh (wrappers_required): Don't set for mingw32ce.
+
+ * autogen.sh: Add option --build-w32ce. Remove --disable-shared
+ from --build-w32.
+
2010-01-08 Marcus Brinkmann <marcus at g10code.de>
Released 2.0.0.
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/ChangeLog 2010-01-22 15:52:40 UTC (rev 350)
@@ -1,3 +1,10 @@
+2010-01-22 Werner Koch <wk at g10code.com>
+
+ * assuan-socket.c (read_port_and_nonce): Replace ENOFILE by a
+ proper ENOENT.
+
+ Replace all assignments to ERRNO by a call to gpg_err_set_errno.
+
2010-01-14 Werner Koch <wk at g10code.com>
* debug.c (_assuan_debug, _assuan_debug_begin)
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/NEWS 2010-01-22 15:52:40 UTC (rev 350)
@@ -3,7 +3,9 @@
* Under development.
+ * Support for WindowsCE.
+
Noteworthy changes in version 2.0.0 (2010-01-08)
------------------------------------------------
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/autogen.sh 2010-01-22 15:52:40 UTC (rev 350)
@@ -36,10 +36,28 @@
shift
fi
+# Convenience option to use certain configure options for some hosts.
+myhost=""
+myhostsub=""
+case "$1" in
+ --build-w32)
+ myhost="w32"
+ ;;
+ --build-w32ce)
+ myhost="w32"
+ myhostsub="ce"
+ ;;
+ --build-amd64)
+ myhost="amd64"
+ ;;
+ *)
+ ;;
+esac
+
# ***** W32 build script *******
# Used to cross-compile for Windows.
-if test "$1" = "--build-w32"; then
+if [ "$myhost" = "w32" ]; then
tmp=`dirname $0`
tsdir=`cd "$tmp"; pwd`
shift
@@ -49,11 +67,20 @@
fi
build=`$tsdir/config.guess`
- [ -z "$w32root" ] && w32root="$HOME/w32root"
+ case $myhostsub in
+ ce)
+ [ -z "$w32root" ] && w32root="$HOME/w32ce_root"
+ toolprefixes="arm-mingw32ce"
+ ;;
+ *)
+ [ -z "$w32root" ] && w32root="$HOME/w32root"
+ toolprefixes="i586-mingw32msvc i386-mingw32msvc"
+ ;;
+ esac
echo "Using $w32root as standard install directory" >&2
crossbindir=
- for host in i586-mingw32msvc i386-mingw32msvc mingw32; do
+ for host in $toolprefixes; do
if ${host}-gcc --version >/dev/null 2>&1 ; then
crossbindir=/usr/${host}/bin
conf_CC="CC=${host}-gcc"
@@ -62,8 +89,10 @@
done
if [ -z "$crossbindir" ]; then
echo "Cross compiler kit not installed" >&2
- echo "Under Debian GNU/Linux, you may install it using" >&2
- echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
+ if [ -z "$sub" ]; then
+ echo "Under Debian GNU/Linux, you may install it using" >&2
+ echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
+ fi
echo "Stop." >&2
exit 1
fi
@@ -77,7 +106,7 @@
./configure --enable-maintainer-mode --prefix=${w32root} \
--host=${host} --build=${build} \
- --disable-shared
+ --with-gpg-error-prefix=${w32root} "$@"
exit $?
fi
@@ -86,7 +115,7 @@
# ***** AMD64 cross build script *******
# Used to cross-compile for AMD64 (for testing)
-if test "$1" = "--build-amd64"; then
+if [ "$myhost" = "amd64" ]; then
tmp=`dirname $0`
tsdir=`cd "$tmp"; pwd`
shift
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/configure.ac 2010-01-22 15:52:40 UTC (rev 350)
@@ -138,12 +138,18 @@
#
have_dosish_system=no
have_w32_system=no
+have_w32ce_system=no
case "${host}" in
*-linux*)
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fPIC -DPIC"
fi
;;
+ *-mingw32de*)
+ have_dosish_system=yes
+ have_w32_system=yes
+ have_w32ce_system=yes
+ ;;
*-mingw32*)
have_dosish_system=yes
have_w32_system=yes
@@ -165,6 +171,9 @@
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
+ if test "$have_w32ce_system" = yes; then
+ AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
+ fi
BUILD_TIMESTAMP=`date --iso-8601=minutes`
AC_SUBST(BUILD_TIMESTAMP)
changequote(,)dnl
@@ -181,6 +190,7 @@
AC_SUBST(BUILD_TIMESTAMP)
AC_SUBST(BUILD_FILEVERSION)
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
+AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
# Check for network libraries. They are needed for tests.
@@ -247,7 +257,7 @@
# Checking for libgpg-error.
-AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found]))
+AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found]))
#
# Checks for library functions.
Modified: trunk/ltmain.sh
===================================================================
--- trunk/ltmain.sh 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/ltmain.sh 2010-01-22 15:52:40 UTC (rev 350)
@@ -7680,15 +7680,15 @@
wrappers_required=yes
case $host in
+ *cegcc | *mingw32ce*)
+ # Disable wrappers for cegcc/mingw32ce, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
*cygwin* | *mingw* )
if test "$build_libtool_libs" != yes; then
wrappers_required=no
fi
;;
- *cegcc)
- # Disable wrappers for cegcc, we are cross compiling anyway.
- wrappers_required=no
- ;;
*)
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
wrappers_required=no
Modified: trunk/src/assuan-buffer.c
===================================================================
--- trunk/src/assuan-buffer.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/assuan-buffer.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -155,7 +155,7 @@
ctx->inbound.attic.linelen = atticlen + nread;
}
- errno = saved_errno;
+ gpg_err_set_errno (saved_errno);
return _assuan_error (ctx, gpg_err_code_from_syserror ());
}
if (!nread)
Modified: trunk/src/assuan-handler.c
===================================================================
--- trunk/src/assuan-handler.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/assuan-handler.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -864,7 +864,7 @@
ctx->outbound.data.error = 0;
return ctx->outbound.data.fp;
#else
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return NULL;
#endif
}
Modified: trunk/src/assuan-logging.c
===================================================================
--- trunk/src/assuan-logging.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/assuan-logging.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -137,7 +137,7 @@
with a LF. */
if (msg && *msg && msg[strlen (msg) - 1] == '\n')
fflush (fp);
- errno = saved_errno;
+ gpg_err_set_errno (saved_errno);
return 0;
}
Modified: trunk/src/assuan-socket.c
===================================================================
--- trunk/src/assuan-socket.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/assuan-socket.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -89,11 +89,11 @@
if (!CryptAcquireContext (&prov, NULL, NULL, PROV_RSA_FULL,
(CRYPT_VERIFYCONTEXT|CRYPT_SILENT)) )
- errno = ENODEV;
+ gpg_err_set_errno (ENODEV);
else
{
if (!CryptGenRandom (prov, nbytes, (unsigned char *) buffer))
- errno = ENODEV;
+ gpg_err_set_errno (ENODEV);
else
ret = 0;
CryptReleaseContext (prov, 0);
@@ -119,14 +119,14 @@
fclose (fp);
if (!nread)
{
- errno = ENOFILE;
+ gpg_err_set_errno (ENOENT);
return -1;
}
buffer[nread] = 0;
aval = atoi (buffer);
if (aval < 1 || aval > 65535)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return -1;
}
*port = (unsigned int)aval;
@@ -134,7 +134,7 @@
;
if (*p != '\n' || nread != 17)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return -1;
}
p++; nread--;
@@ -156,7 +156,7 @@
domain = AF_INET;
res = SOCKET2HANDLE(socket (domain, type, proto));
if (res == ASSUAN_INVALID_FD)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ()));
return res;
#else
return socket (domain, type, proto);
@@ -198,7 +198,7 @@
ret = _assuan_write (ctx, sockfd, nonce, 16);
if (ret >= 0 && ret != 16)
{
- errno = EIO;
+ gpg_err_set_errno (EIO);
ret = -1;
}
}
@@ -209,7 +209,7 @@
int res;
res = connect (HANDLE2SOCKET (sockfd), addr, addrlen);
if (res < 0)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ()));
return res;
}
#else
@@ -248,7 +248,7 @@
if (filefd == -1)
{
if (errno == EEXIST)
- errno = WSAEADDRINUSE;
+ gpg_err_set_errno (WSAEADDRINUSE);
return -1;
}
fp = fdopen (filefd, "wb");
@@ -256,7 +256,7 @@
{
int save_e = errno;
close (filefd);
- errno = save_e;
+ gpg_err_set_errno (save_e);
return -1;
}
@@ -269,7 +269,7 @@
int save_e = errno;
fclose (fp);
remove (unaddr->sun_path);
- errno = save_e;
+ gpg_err_set_errno (save_e);
return rc;
}
fprintf (fp, "%d\n", ntohs (myaddr.sin_port));
@@ -282,7 +282,7 @@
{
int res = bind (HANDLE2SOCKET(sockfd), addr, addrlen);
if (res < 0)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()));
return res;
}
#else
@@ -303,7 +303,7 @@
if (sizeof nonce->nonce != 16)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return -1;
}
nonce->length = 16;
@@ -336,7 +336,7 @@
if (sizeof nonce->nonce != 16)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return -1;
}
@@ -345,7 +345,7 @@
if (nonce->length != 16)
{
- errno = EINVAL;
+ gpg_err_set_errno (EINVAL);
return -1;
}
@@ -362,7 +362,7 @@
return -1;
else if (!n)
{
- errno = EIO;
+ gpg_err_set_errno (EIO);
return -1;
}
else
@@ -373,7 +373,7 @@
}
if (memcmp (buffer, nonce->nonce, 16))
{
- errno = EACCES;
+ gpg_err_set_errno (EACCES);
return -1;
}
#else
Modified: trunk/src/assuan-uds.c
===================================================================
--- trunk/src/assuan-uds.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/assuan-uds.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -136,7 +136,7 @@
#else /*HAVE_W32_SYSTEM*/
int res = recvfrom (HANDLE2SOCKET(ctx->inbound.fd), buf, buflen, 0, NULL, NULL);
if (res < 0)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno (_assuan_sock_wsa2errno (WSAGetLastError ()));
return res;
#endif /*HAVE_W32_SYSTEM*/
}
@@ -168,7 +168,7 @@
(struct sockaddr *)&ctx->serveraddr,
sizeof (struct sockaddr_in));
if (res < 0)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()));
return res;
#endif /*HAVE_W32_SYSTEM*/
}
Modified: trunk/src/debug.c
===================================================================
--- trunk/src/debug.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/debug.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -60,7 +60,7 @@
return;
ctx->log_cb (ctx, ctx->log_cb_data, cat, msg);
free (msg);
- errno = saved_errno;
+ gpg_err_set_errno (saved_errno);
}
Modified: trunk/src/system.c
===================================================================
--- trunk/src/system.c 2010-01-14 21:16:55 UTC (rev 349)
+++ trunk/src/system.c 2010-01-22 15:52:40 UTC (rev 350)
@@ -57,7 +57,7 @@
GetCurrentProcess(), &ofd, 0,
TRUE, DUPLICATE_SAME_ACCESS))
{
- errno = EIO;
+ gpg_err_set_errno (EIO);
return ASSUAN_INVALID_FD;
}
return ofd;
@@ -92,7 +92,7 @@
/* Check for overflow. */
if (elsize && nbytes / elsize != cnt)
{
- errno = ENOMEM;
+ gpg_err_set_errno (ENOMEM);
return NULL;
}
@@ -203,7 +203,7 @@
{
TRACE1 (ctx, ASSUAN_LOG_SYSIO, "__assuan_pipe", ctx,
"CreatePipe failed: %s", _assuan_w32_strerror (ctx, -1));
- errno = EIO;
+ gpg_err_set_errno (EIO);
return -1;
}
@@ -215,7 +215,7 @@
"DuplicateHandle failed: %s", _assuan_w32_strerror (ctx, -1));
CloseHandle (rh);
CloseHandle (wh);
- errno = EIO;
+ gpg_err_set_errno (EIO);
return -1;
}
if (inherit_idx == 0)
@@ -264,13 +264,13 @@
#ifdef HAVE_W32_SYSTEM
int rc = closesocket (HANDLE2SOCKET(fd));
if (rc)
- errno = _assuan_sock_wsa2errno (WSAGetLastError ());
+ gpg_err_set_errno ( _assuan_sock_wsa2errno (WSAGetLastError ()) );
if (rc && WSAGetLastError () == WSAENOTSOCK)
{
rc = CloseHandle (fd);
if (rc)
/* FIXME. */
- errno = EIO;
+ gpg_err_set_errno (EIO);
}
return rc;
#else
@@ -315,11 +315,11 @@
switch (GetLastError ())
{
case ERROR_BROKEN_PIPE:
- errno = EPIPE;
+ gpg_err_set_errno (EPIPE);
break;
default:
- errno = EIO;
+ gpg_err_set_errno (EIO);
}
res = -1;
}
@@ -329,15 +329,15 @@
break;
case WSAEWOULDBLOCK:
- errno = EAGAIN;
+ gpg_err_set_errno (EAGAIN);
break;
case ERROR_BROKEN_PIPE:
- errno = EPIPE;
+ gpg_err_set_errno (EPIPE);
break;
default:
- errno = EIO;
+ gpg_err_set_errno (EIO);
break;
}
}
@@ -385,11 +385,11 @@
{
case ERROR_BROKEN_PIPE:
case ERROR_NO_DATA:
- errno = EPIPE;
+ gpg_err_set_errno (EPIPE);
break;
default:
- errno = EIO;
+ gpg_err_set_errno (EIO);
break;
}
res = -1;
@@ -425,7 +425,7 @@
int flags)
{
#ifdef HAVE_W32_SYSTEM
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return -1;
#else
int ret;
@@ -477,7 +477,7 @@
int flags)
{
#ifdef HAVE_W32_SYSTEM
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return -1;
#else
int ret;
@@ -640,7 +640,7 @@
TRACE1 (ctx, ASSUAN_LOG_SYSIO, "__assuan_spawn", ctx,
"can't open `nul': %s", _assuan_w32_strerror (ctx, -1));
_assuan_free (ctx, cmdline);
- errno = EIO;
+ gpg_err_set_errno (EIO);
return -1;
}
si.hStdError = nullfd;
@@ -675,7 +675,7 @@
if (nullfd != INVALID_HANDLE_VALUE)
CloseHandle (nullfd);
- errno = EIO;
+ gpg_err_set_errno (EIO);
return -1;
}
@@ -818,7 +818,7 @@
if (!(fdp && *fdp != -1))
close (i);
}
- errno = 0;
+ gpg_err_set_errno (0);
if (! name)
{
@@ -948,7 +948,7 @@
int protocol, assuan_fd_t filedes[2])
{
#if HAVE_W32_SYSTEM
- errno = ENOSYS;
+ gpg_err_set_errno (ENOSYS);
return -1;
#else
return socketpair (namespace, style, protocol, filedes);
More information about the Gnupg-commits
mailing list