fix linux/getifstats.c when bitrate is unknown

This commit is contained in:
Thomas Bernard 2012-04-06 17:30:22 +02:00
parent 7474d22cf9
commit 225b59a6d3
2 changed files with 9 additions and 4 deletions

View File

@ -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.

View File

@ -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 {