diff options
-rw-r--r-- | lib/route/qdisc/netem.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/route/qdisc/netem.c b/lib/route/qdisc/netem.c index 997a31f..5f26096 100644 --- a/lib/route/qdisc/netem.c +++ b/lib/route/qdisc/netem.c @@ -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 ) |