Use readdir instead of readdir_r
To eliminate compiler warnings, we're single-threaded anyway.
This commit is contained in:
@@ -424,20 +424,9 @@ initialize (void *ctx, struct plugin_api *api)
|
||||
lua_setfield (L, -2, "__index");
|
||||
luaL_setfuncs (L, xlua_unit_table, 0);
|
||||
|
||||
struct dirent buf, *iter;
|
||||
while (true)
|
||||
struct dirent *iter;
|
||||
while ((errno = 0, iter = readdir (dir)))
|
||||
{
|
||||
if (readdir_r (dir, &buf, &iter))
|
||||
{
|
||||
print_fatal ("%s: %s: %s", "Lua", "readdir_r", strerror (errno));
|
||||
break;
|
||||
}
|
||||
if (!iter)
|
||||
{
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
|
||||
char *dot = strrchr (iter->d_name, '.');
|
||||
if (!dot || strcmp (dot, ".lua"))
|
||||
continue;
|
||||
@@ -446,6 +435,10 @@ initialize (void *ctx, struct plugin_api *api)
|
||||
(void) load_one_plugin (L, iter->d_name, path);
|
||||
free (path);
|
||||
}
|
||||
if (errno)
|
||||
print_fatal ("%s: %s: %s", "Lua", "readdir", strerror (errno));
|
||||
else
|
||||
success = true;
|
||||
|
||||
end:
|
||||
closedir (dir);
|
||||
|
||||
Reference in New Issue
Block a user