From cf3a673589aa2b89a25ddcb9b36bf61bd053220e Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Tue, 2 Oct 2012 12:49:20 +0000 Subject: use stat in is_dir (). git-svn-id: svn://tug.org/texlive/trunk@27866 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 4 ++++ Build/source/texk/kpathsea/win32lib.c | 16 ++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'Build/source/texk') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 5c908834df5..d2ccb97e461 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,7 @@ +2012-10-02 Akira Kakuto + + * win32lib.c: use stat in static int is_dir (). + 2012-10-01 Akira Kakuto * win32lib.c: remove _osver since it is obsolete. diff --git a/Build/source/texk/kpathsea/win32lib.c b/Build/source/texk/kpathsea/win32lib.c index 274dc2c9f60..bff2f1e94ee 100644 --- a/Build/source/texk/kpathsea/win32lib.c +++ b/Build/source/texk/kpathsea/win32lib.c @@ -19,6 +19,7 @@ #include #include #include +#include FILE * __cdecl kpathsea_win32_popen (kpathsea kpse, const char *cmd, const char *fmode) { @@ -322,18 +323,9 @@ xfseek64 (FILE *f, __int64 offset, int wherefrom, const char *filename) 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