Skip to content

Commit

Permalink
lib/route: add /usr/lib64/tc/ search path for netem dist file
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Aug 14, 2017
1 parent cda0d80 commit 69b730e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/route/qdisc/netem.c
Expand Up @@ -886,14 +886,20 @@ int rtnl_netem_set_delay_distribution(struct rtnl_qdisc *qdisc, const char *dist
char name[NAME_MAX];
char dist_suffix[] = ".dist";

/* Check several locations for the dist file */
char *test_path[] = {
"",
"./",
"/usr/lib/tc/",
"/usr/lib64/tc/",
"/usr/local/lib/tc/",
};

/* If the given filename already ends in .dist, don't append it later */
char *test_suffix = strstr(dist_type, dist_suffix);
if (test_suffix != NULL && strlen(test_suffix) == 5)
strcpy(dist_suffix, "");

/* Check several locations for the dist file */
char *test_path[] = { "", "./", "/usr/lib/tc/", "/usr/local/lib/tc/" };

for (i = 0; i < ARRAY_SIZE(test_path); i++) {
snprintf(name, NAME_MAX, "%s%s%s", test_path[i], dist_type, dist_suffix);
if ((f = fopen(name, "re")))
Expand Down

0 comments on commit 69b730e

Please sign in to comment.