summaryrefslogtreecommitdiffstats
path: root/src/client/rspamc.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-01-09 11:47:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-01-09 18:41:43 +0000
commit9a821ac77f2e0c8807ac5bf84d431070df618166 (patch)
tree7258f5d8ee0a8882b1f87df2b0f61f167bd5ec0f /src/client/rspamc.c
parent9ac5c84396116cd34268cc1c1bb2cdcbdf00bc1c (diff)
downloadrspamd-9a821ac77f2e0c8807ac5bf84d431070df618166.tar.gz
rspamd-9a821ac77f2e0c8807ac5bf84d431070df618166.zip
[Minor] Refrain from readdir_r usage
Diffstat (limited to 'src/client/rspamc.c')
-rw-r--r--src/client/rspamc.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 5b5253628..bcc302f95 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -1680,26 +1680,17 @@ rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd,
const gchar *name, GQueue *attrs)
{
DIR *d;
- struct dirent *entry, *pentry;
+ struct dirent *pentry;
gint cur_req = 0;
gchar fpath[PATH_MAX];
FILE *in;
struct stat st;
gboolean is_reg, is_dir;
- gsize len;
d = opendir (name);
if (d != NULL) {
- /* Portably allocate struct direntry */
- len = rspamd_dirent_size (d);
- g_assert (len != (gsize)-1);
- entry = g_malloc0 (len);
-
- while (readdir_r (d, entry, &pentry) == 0 && pentry != NULL) {
- if (pentry == NULL) {
- break;
- }
+ while ((pentry = readdir (d))!= NULL) {
if (pentry->d_name[0] == '.') {
continue;
@@ -1765,8 +1756,6 @@ rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd,
}
}
}
-
- g_free (entry);
}
else {
fprintf (stderr, "cannot open directory %s: %s\n", name, strerror (errno));