From 3c02a9fad304101bcfce495d881c9590f6998943 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 3 Oct 2012 10:50:44 +0000 Subject: use stat in is_dir (). git-svn-id: svn://tug.org/texlive/trunk@27870 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 4 ++++ Build/source/texk/kpathsea/mingw32.c | 16 ++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'Build/source/texk/kpathsea') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index d2ccb97e461..8207f8dabbf 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2012-10-03 Peter Breitenlohner + + * mingw32.c: use stat in static int is_dir (). + 2012-10-02 Akira Kakuto * win32lib.c: use stat in static int is_dir (). diff --git a/Build/source/texk/kpathsea/mingw32.c b/Build/source/texk/kpathsea/mingw32.c index c0d037b41ca..488bc013e11 100644 --- a/Build/source/texk/kpathsea/mingw32.c +++ b/Build/source/texk/kpathsea/mingw32.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -490,18 +491,9 @@ look_for_cmd(const char *cmd, char **app) static int is_dir (char *buff) { - HANDLE h; - WIN32_FIND_DATA w32fd; - - if (((h = FindFirstFile (buff, &w32fd)) - != INVALID_HANDLE_VALUE) && - (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - FindClose (h); - return (1); - } else { - FindClose (h); - return (0); - } + struct stat stats; + + return stat (buff, &stats) == 0 && S_ISDIR (stats.st_mode); } /* -- cgit v1.2.3