diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2017-01-29 21:04:50 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2017-01-29 21:04:50 +0100 |
commit | 38a1214af1c2dbe2e57e96451a10f9c058fa3f20 (patch) | |
tree | 88c15af5c71feee4fb9b9bd37a6aea0d83789991 /ponymap.c | |
parent | aceeb3f4c917076138b9efd8696afa94d00f6832 (diff) | |
download | ponymap-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 'ponymap.c')
-rw-r--r-- | ponymap.c | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -894,20 +894,9 @@ load_plugins (struct app_context *ctx) } bool success = false; - 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", "readdir_r", strerror (errno)); - break; - } - if (!iter) - { - success = true; - break; - } - char *dot = strrchr (iter->d_name, '.'); if (!dot || strcmp (dot, ".so")) continue; @@ -916,6 +905,11 @@ load_plugins (struct app_context *ctx) (void) load_one_plugin (ctx, iter->d_name, path); free (path); } + if (errno) + print_fatal ("%s: %s", "readdir", strerror (errno)); + else + success = true; + closedir (dir); return success; } |