aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-19 09:07:29 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-19 09:07:51 +0200
commitdff4e316bb85b85216699e6fe0c98539aeb42a49 (patch)
tree4be449f85008ad5f4168401bea2abcd8799f025e
parente3dc2fecfac98427efb7a7efd319e1f2a7bead68 (diff)
downloadfiv-dff4e316bb85b85216699e6fe0c98539aeb42a49.tar.gz
fiv-dff4e316bb85b85216699e6fe0c98539aeb42a49.tar.xz
fiv-dff4e316bb85b85216699e6fe0c98539aeb42a49.zip
Don't try to open directories
-rw-r--r--fastiv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fastiv.c b/fastiv.c
index 39b0c5e..6a74216 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -292,7 +292,11 @@ load_directory(const gchar *dirname)
GDir *dir = g_dir_open(dirname, 0, &error);
if (dir) {
for (const gchar *name = NULL; (name = g_dir_read_name(dir)); ) {
- if (!is_supported(name))
+ // This really wants to make you use readdir() directly.
+ char *absolute = g_canonicalize_filename(name, g.directory);
+ gboolean is_dir = g_file_test(absolute, G_FILE_TEST_IS_DIR);
+ g_free(absolute);
+ if (is_dir || !is_supported(name))
continue;
// XXX: We presume that this basename is from the same directory.