Commit a51e233f authored by David Woodhouse's avatar David Woodhouse

Work around time() brokenness on Solaris.

On Solaris and OpenIndiana, time() goes backwards. It and gettimeofday()
occasionally jump back to 1970 and return zero seconds — although the
tv_usec field is still sane, bizarrely.

CR7121035 in Solaris, https://www.illumos.org/issues/1871 in OpenIndiana.

It seems that gethrtime() doesn't suffer the same problem, so let's use
that instead of time() for now.
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 418fade4
......@@ -17,7 +17,7 @@ openconnect_SOURCES = xml.c main.c dtls.c cstp.c mainloop.c tun.c
openconnect_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS) $(ZLIB_CFLAGS)
openconnect_LDADD = libopenconnect.la $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(ZLIB_LIBS) $(LIBINTL)
library_srcs = ssl.c http.c auth.c library.c
library_srcs = ssl.c http.c auth.c library.c compat.c
libopenconnect_la_SOURCES = version.c $(library_srcs)
libopenconnect_la_CFLAGS = $(OPENSSL_CFLAGS) $(LIBXML2_CFLAGS) $(LIBPROXY_CFLAGS)
libopenconnect_la_LIBADD = $(OPENSSL_LIBS) $(LIBXML2_LIBS) $(LIBPROXY_LIBS) $(LIBINTL)
......
/*
* OpenConnect (SSL + DTLS) VPN client
*
* Copyright © 2008-2012 Intel Corporation.
*
* Authors: David Woodhouse <dwmw2@infradead.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to:
*
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#include "openconnect-internal.h"
#ifdef __sun__
#include <sys/time.h>
time_t openconnect__time(time_t *t)
{
time_t s = gethrtime() / 1000000000LL;
if (t)
*t = s;
return s;
}
#endif
......@@ -240,6 +240,10 @@ struct openconnect_info {
/****************************************************************************/
/* Oh Solaris how we hate thee! */
#ifdef __sun__
#define time(x) openconnect__time(x)
time_t openconnect__time(time_t *t);
#endif
#ifndef HAVE_ASPRINTF
#define asprintf openconnect__asprintf
int openconnect__asprintf(char **strp, const char *fmt, ...);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment