miniupnpd: time() => upnp_time()

I had forgotten some
see #288
This commit is contained in:
Thomas Bernard 2018-03-14 00:09:42 +01:00
parent 9516c9a007
commit ef94635100
5 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ getifstats(const char *ifname, struct ifdata *data)
return -1; return -1;
#ifdef ENABLE_GETIFSTATS_CACHING #ifdef ENABLE_GETIFSTATS_CACHING
current_time = time(NULL); current_time = upnp_time();
if (ifap != NULL && if (ifap != NULL &&
current_time < cache_timestamp + GETIFSTATS_CACHING_DURATION) current_time < cache_timestamp + GETIFSTATS_CACHING_DURATION)
goto copy; goto copy;

View File

@ -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 /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * 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 * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -48,7 +48,7 @@ getifstats(const char * ifname, struct ifdata * data)
if(!ifname || ifname[0]=='\0') if(!ifname || ifname[0]=='\0')
return -1; return -1;
#ifdef ENABLE_GETIFSTATS_CACHING #ifdef ENABLE_GETIFSTATS_CACHING
current_time = time(NULL); current_time = upnp_time();
if(current_time == ((time_t)-1)) { if(current_time == ((time_t)-1)) {
syslog(LOG_ERR, "getifstats() : time() error : %m"); syslog(LOG_ERR, "getifstats() : time() error : %m");
} else { } else {

View File

@ -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 * MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
@ -45,7 +45,7 @@ int getifstats(const char * ifname, struct ifdata * data) {
data->ibytes = 0; data->ibytes = 0;
#ifdef ENABLE_GETIFSTATS_CACHING #ifdef ENABLE_GETIFSTATS_CACHING
current_time = time(NULL); current_time = upnp_time();
if (current_time == ((time_t)-1)) { if (current_time == ((time_t)-1)) {
syslog(LOG_ERR, "getifstats() : time() error : %m"); syslog(LOG_ERR, "getifstats() : time() error : %m");
} else { } else {

View File

@ -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 /* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * 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 * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * in the LICENCE file provided within the distribution */
@ -458,7 +458,7 @@ clean_pinhole_list(unsigned int * next_timestamp)
time_t current_time; time_t current_time;
int n = 0; int n = 0;
current_time = time(NULL); current_time = upnp_time();
p = pinhole_list.lh_first; p = pinhole_list.lh_first;
while(p != NULL) { while(p != NULL) {
if(p->timestamp <= (unsigned int)current_time) { if(p->timestamp <= (unsigned int)current_time) {

View File

@ -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 /* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project * MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ * 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 * This software is subject to the conditions detailed
* in the LICENCE file provided within the distribution */ * 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"); syslog(LOG_ERR, "pf device is not open");
return -1; return -1;
} }
current_time = time(NULL); current_time = upnp_time();
memset(&pr, 0, sizeof(pr)); memset(&pr, 0, sizeof(pr));
strlcpy(pr.anchor, anchor_name, MAXPATHLEN); strlcpy(pr.anchor, anchor_name, MAXPATHLEN);
#ifndef PF_NEWSTYLE #ifndef PF_NEWSTYLE