diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-26 14:53:18 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-26 14:53:18 +0100 |
commit | 582e212af4385fdaeb2e209fde6cb5a795a29a3a (patch) | |
tree | 4e18fbf75391b1fe20704b0470090e32fd74ee8d /src/libutil/util.c | |
parent | 3372fed16cf394202c365909b49f01e219fc1116 (diff) | |
download | rspamd-582e212af4385fdaeb2e209fde6cb5a795a29a3a.tar.gz rspamd-582e212af4385fdaeb2e209fde6cb5a795a29a3a.zip |
[Minor] Use new routine for globbing
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index 0b76f193b..510b16045 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -80,7 +80,7 @@ #endif #endif #include <math.h> /* for pow */ -#include <glob.h> +#include <glob.h> /* in fact, we require this file ultimately */ #include "cryptobox.h" #include "zlib.h" @@ -2858,6 +2858,7 @@ rspamd_glob_dir (const gchar *full_path, const gchar *pattern, const gchar *path; static gchar pathbuf[PATH_MAX]; /* Static to help recursion */ guint i; + gint rc; static const guint rec_lim = 16; struct stat st; @@ -2870,12 +2871,20 @@ rspamd_glob_dir (const gchar *full_path, const gchar *pattern, memset (&globbuf, 0, sizeof (globbuf)); - if (glob (full_path, 0, NULL, &globbuf) != 0) { - g_set_error (err, g_quark_from_static_string ("glob"), errno, - "glob %s failed: %s", full_path, strerror (errno)); - globfree (&globbuf); + if ((rc = glob (full_path, 0, NULL, &globbuf)) != 0) { - return FALSE; + if (rc != GLOB_NOMATCH) { + g_set_error (err, g_quark_from_static_string ("glob"), errno, + "glob %s failed: %s", full_path, strerror (errno)); + globfree (&globbuf); + + return FALSE; + } + else { + globfree (&globbuf); + + return TRUE; + } } for (i = 0; i < globbuf.gl_pathc; i ++) { |