rtnl_netem_set_delay_distribution: fix possible segfault

fix counting of elements in array. Just typo, as I think.
This commit is contained in:
Коренберг Марк (ноутбук дома) 2012-06-08 00:58:14 +06:00
parent 2275bb0aaa
commit d3dcde2585

View file

@ -826,7 +826,7 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist
if (!(netem = rtnl_tc_data(TC_CAST(qdisc))))
BUG();
FILE *f = NULL;
FILE *f;
int i, n = 0;
size_t len = 2048;
char *line;
@ -841,9 +841,10 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist
/* Check several locations for the dist file */
char *test_path[] = { "", "./", "/usr/lib/tc/", "/usr/local/lib/tc/" };
for (i = 0; i < sizeof(test_path) && f == NULL; i++) {
for (i = 0; i < sizeof(test_path)/sizeof(test_path[0]); i++) {
snprintf(name, NAME_MAX, "%s%s%s", test_path[i], dist_type, dist_suffix);
f = fopen(name, "r");
if ((f = fopen(name, "r")))
break;
}
if ( f == NULL )