From: Akira TAGOH Date: Tue, 22 Oct 2013 06:00:29 +0000 (+0900) Subject: Use stat() if there are no d_type in struct dirent X-Git-Tag: 2.11.1~35 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Ffontconfig.git;a=commitdiff_plain;h=76ea9af816a50c6bb0b3dc2960460a90fadd9cdb Use stat() if there are no d_type in struct dirent Reported by Thomas Klausner --- diff --git a/test/test-migration.c b/test/test-migration.c index a0ab839..9709651 100644 --- a/test/test-migration.c +++ b/test/test-migration.c @@ -4,6 +4,11 @@ #include #include #include +#ifndef HAVE_STRUCT_DIRENT_D_TYPE +#include +#include +#include +#endif #include FcBool @@ -36,6 +41,9 @@ unlink_dirs(const char *dir) size_t len = strlen (dir); char *n = NULL; FcBool ret = FcTrue; +#ifndef HAVE_STRUCT_DIRENT_D_TYPE + struct stat statb; +#endif if (!d) return FcFalse; @@ -53,7 +61,17 @@ unlink_dirs(const char *dir) strcpy (n, dir); n[len] = '/'; strcpy (&n[len + 1], e->d_name); +#ifdef HAVE_STRUCT_DIRENT_D_TYPE if (e->d_type == DT_DIR) +#else + if (stat (n, &statb) == -1) + { + fprintf (stderr, "E: %s\n", n); + ret = FcFalse; + break; + } + if (S_ISDIR (statb.st_mode)) +#endif { if (!unlink_dirs (n)) {