From ef946351006d86235f9e2333ec9c1ef051b5d489 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Wed, 14 Mar 2018 00:09:42 +0100 Subject: [PATCH] miniupnpd: time() => upnp_time() I had forgotten some see #288 --- miniupnpd/bsd/getifstats.c | 2 +- miniupnpd/linux/getifstats.c | 6 +++--- miniupnpd/mac/getifstats.c | 4 ++-- miniupnpd/netfilter/iptpinhole.c | 6 +++--- miniupnpd/pf/pfpinhole.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/miniupnpd/bsd/getifstats.c b/miniupnpd/bsd/getifstats.c index e3e1b2d..5443a99 100644 --- a/miniupnpd/bsd/getifstats.c +++ b/miniupnpd/bsd/getifstats.c @@ -40,7 +40,7 @@ getifstats(const char *ifname, struct ifdata *data) return -1; #ifdef ENABLE_GETIFSTATS_CACHING - current_time = time(NULL); + current_time = upnp_time(); if (ifap != NULL && current_time < cache_timestamp + GETIFSTATS_CACHING_DURATION) goto copy; diff --git a/miniupnpd/linux/getifstats.c b/miniupnpd/linux/getifstats.c index 3feabdd..5a4386c 100644 --- a/miniupnpd/linux/getifstats.c +++ b/miniupnpd/linux/getifstats.c @@ -1,7 +1,7 @@ -/* $Id: getifstats.c,v 1.12 2013/04/29 10:18:20 nanard Exp $ */ +/* $Id: getifstats.c,v 1.14 2018/03/13 23:05:21 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2013 Thomas Bernard + * (c) 2006-2018 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -48,7 +48,7 @@ getifstats(const char * ifname, struct ifdata * data) if(!ifname || ifname[0]=='\0') return -1; #ifdef ENABLE_GETIFSTATS_CACHING - current_time = time(NULL); + current_time = upnp_time(); if(current_time == ((time_t)-1)) { syslog(LOG_ERR, "getifstats() : time() error : %m"); } else { diff --git a/miniupnpd/mac/getifstats.c b/miniupnpd/mac/getifstats.c index 058d956..83ab7f8 100644 --- a/miniupnpd/mac/getifstats.c +++ b/miniupnpd/mac/getifstats.c @@ -1,4 +1,4 @@ -/* $Id: getifstats.c,v 1.6 2012/02/11 13:10:57 nanard Exp $ */ +/* $Id: getifstats.c,v 1.8 2018/03/13 23:05:21 nanard Exp $ */ /* * MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ @@ -45,7 +45,7 @@ int getifstats(const char * ifname, struct ifdata * data) { data->ibytes = 0; #ifdef ENABLE_GETIFSTATS_CACHING - current_time = time(NULL); + current_time = upnp_time(); if (current_time == ((time_t)-1)) { syslog(LOG_ERR, "getifstats() : time() error : %m"); } else { diff --git a/miniupnpd/netfilter/iptpinhole.c b/miniupnpd/netfilter/iptpinhole.c index 33d0f0e..8d45f20 100644 --- a/miniupnpd/netfilter/iptpinhole.c +++ b/miniupnpd/netfilter/iptpinhole.c @@ -1,7 +1,7 @@ -/* $Id: iptpinhole.c,v 1.14 2015/02/10 15:01:03 nanard Exp $ */ +/* $Id: iptpinhole.c,v 1.18 2018/03/13 23:05:21 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2012-2017 Thomas Bernard + * (c) 2012-2018 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -458,7 +458,7 @@ clean_pinhole_list(unsigned int * next_timestamp) time_t current_time; int n = 0; - current_time = time(NULL); + current_time = upnp_time(); p = pinhole_list.lh_first; while(p != NULL) { if(p->timestamp <= (unsigned int)current_time) { diff --git a/miniupnpd/pf/pfpinhole.c b/miniupnpd/pf/pfpinhole.c index fd5d38f..e0f0959 100644 --- a/miniupnpd/pf/pfpinhole.c +++ b/miniupnpd/pf/pfpinhole.c @@ -1,8 +1,8 @@ -/* $Id: pfpinhole.c,v 1.24 2014/12/05 09:54:55 nanard Exp $ */ +/* $Id: pfpinhole.c,v 1.27 2018/03/13 23:05:21 nanard Exp $ */ /* vim: tabstop=4 shiftwidth=4 noexpandtab * MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2012-2017 Thomas Bernard + * (c) 2012-2018 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -379,7 +379,7 @@ int clean_pinhole_list(unsigned int * next_timestamp) syslog(LOG_ERR, "pf device is not open"); return -1; } - current_time = time(NULL); + current_time = upnp_time(); memset(&pr, 0, sizeof(pr)); strlcpy(pr.anchor, anchor_name, MAXPATHLEN); #ifndef PF_NEWSTYLE