miniupnpd: fix storing of unlimited lease time in lease_file

see #295
This commit is contained in:
Thomas Bernard 2018-05-01 11:26:19 +02:00
parent 17773f0a72
commit f6ac854f0f
1 changed files with 4 additions and 2 deletions

View File

@ -111,10 +111,12 @@ lease_file_add(unsigned short eport,
/* convert our time to unix time
* if LEASEFILE_USE_REMAINING_TIME is defined, only the remaining time is stored */
timestamp -= upnp_time();
if (timestamp != 0) {
timestamp -= upnp_time();
#ifndef LEASEFILE_USE_REMAINING_TIME
timestamp += time(NULL);
timestamp += time(NULL);
#endif
}
fprintf(fd, "%s:%hu:%s:%hu:%u:%s\n",
proto_itoa(proto), eport, iaddr, iport,