rtnl_netem_set_delay_distribution: fix possible segfault
fix counting of elements in array. Just typo, as I think.
This commit is contained in:
parent
2275bb0aaa
commit
d3dcde2585
1 changed files with 4 additions and 3 deletions
|
@ -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 )
|
||||
|
|
Loading…
Add table
Reference in a new issue