From 225b59a6d33b7c4610984c0b651f9e6accb15bdf Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Fri, 6 Apr 2012 17:30:22 +0200 Subject: [PATCH] fix linux/getifstats.c when bitrate is unknown --- miniupnpd/Changelog.txt | 5 ++++- miniupnpd/linux/getifstats.c | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/miniupnpd/Changelog.txt b/miniupnpd/Changelog.txt index 08b5ab9..17267bf 100644 --- a/miniupnpd/Changelog.txt +++ b/miniupnpd/Changelog.txt @@ -1,4 +1,7 @@ -$Id: Changelog.txt,v 1.265 2012/03/31 06:57:11 nanard Exp $ +$Id: Changelog.txt,v 1.266 2012/04/06 15:27:20 nanard Exp $ + +2012/04/06: + fix linux/getifstats.c when bitrate is unknown 2012/03/31: Only remove pidfile if one was written in the first place. diff --git a/miniupnpd/linux/getifstats.c b/miniupnpd/linux/getifstats.c index edb1ecd..7571c8d 100644 --- a/miniupnpd/linux/getifstats.c +++ b/miniupnpd/linux/getifstats.c @@ -1,7 +1,7 @@ -/* $Id: getifstats.c,v 1.9 2011/05/25 22:22:57 nanard Exp $ */ +/* $Id: getifstats.c,v 1.11 2012/04/06 15:26:45 nanard Exp $ */ /* MiniUPnP project * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ - * (c) 2006-2011 Thomas Bernard + * (c) 2006-2012 Thomas Bernard * This software is subject to the conditions detailed * in the LICENCE file provided within the distribution */ @@ -91,7 +91,9 @@ getifstats(const char * ifname, struct ifdata * data) f = fopen(fname, "r"); if(f) { if(fgets(line, sizeof(line), f)) { - data->baudrate = 1000000*atoi(line); + i = atoi(line); /* 65535 means unknown */ + if(i > 0 && i < 65535) + data->baudrate = 1000000*i; } fclose(f); } else {