From 51df37c21c7ece866048c57a2c17db4e2b13a88f Mon Sep 17 00:00:00 2001 From: John Popplewell Date: Sun, 12 Aug 2007 23:21:25 +0000 Subject: [PATCH] Fix for f->d_type always being DT_UNKNOWN, using stat(). --- src/tuxpaint.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index b5fcb870f..b8c72e4ff 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -16563,10 +16563,11 @@ void load_magic_plugins(void) if (f != NULL) { - if (f->d_type == DT_REG) - { - snprintf(fname, sizeof(fname), "%s%s", place, f->d_name); + struct stat sbuf; + snprintf(fname, sizeof(fname), "%s%s", place, f->d_name); + if (!stat(fname, &sbuf) && S_ISREG(sbuf.st_mode)) + { /* Get just the name of the object (e.g., "negative"), w/o filename extension: */