Commit c6bbde3a authored by Brad Hards's avatar Brad Hards Committed by Rusty Russell

tools: avoid needless post increment on size

Also add a note about a possible segfault.
parent 4fc9ee36
...@@ -53,7 +53,8 @@ static char **get_dir(const char *dir) ...@@ -53,7 +53,8 @@ static char **get_dir(const char *dir)
names[size++] names[size++]
= talloc_asprintf(names, "%s/%s", dir, ent->d_name); = talloc_asprintf(names, "%s/%s", dir, ent->d_name);
} }
names[size++] = NULL; /* FIXME: if the loop doesn't run at least once, we'll segfault here */
names[size] = NULL;
closedir(d); closedir(d);
return names; return names;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment