diff --git a/src/espeak.c b/src/espeak.c index 7a24266e..c371d42e 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -114,7 +114,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size); diff --git a/src/libespeak-ng/speak_lib.c b/src/libespeak-ng/speak_lib.c index e0e3fd1e..01d3f1bf 100644 --- a/src/libespeak-ng/speak_lib.c +++ b/src/libespeak-ng/speak_lib.c @@ -298,8 +298,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) - // if(S_ISDIR(statbuf.st_mode)) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size); diff --git a/src/speak.c b/src/speak.c index c38cbf32..55667ca3 100644 --- a/src/speak.c +++ b/src/speak.c @@ -138,8 +138,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) -// if(S_ISDIR(statbuf.st_mode)) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size);