aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-01-29 21:04:50 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2017-01-29 21:04:50 +0100
commit38a1214af1c2dbe2e57e96451a10f9c058fa3f20 (patch)
tree88c15af5c71feee4fb9b9bd37a6aea0d83789991 /plugins
parentaceeb3f4c917076138b9efd8696afa94d00f6832 (diff)
downloadponymap-38a1214af1c2dbe2e57e96451a10f9c058fa3f20.tar.gz
ponymap-38a1214af1c2dbe2e57e96451a10f9c058fa3f20.tar.xz
ponymap-38a1214af1c2dbe2e57e96451a10f9c058fa3f20.zip
Use readdir instead of readdir_r
To eliminate compiler warnings, we're single-threaded anyway.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/lua-loader.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/plugins/lua-loader.c b/plugins/lua-loader.c
index 8fa1875..725ba06 100644
--- a/plugins/lua-loader.c
+++ b/plugins/lua-loader.c
@@ -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);