comparison src/os_unix.c @ 14509:80f715651c4c v8.1.0268

patch 8.1.0268: file type checking has too many #ifdef commit https://github.com/vim/vim/commit/d569bb029983cff947dce704e6f830276204c13f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 11 13:57:20 2018 +0200 patch 8.1.0268: file type checking has too many #ifdef Problem: File type checking has too many #ifdef. Solution: Always define the S_IF macros. (Ken Takata, closes https://github.com/vim/vim/issues/3306)
author Christian Brabandt <cb@256bit.org>
date Sat, 11 Aug 2018 14:00:05 +0200
parents 3375a8cbb442
children 738e9d1ac4d2
comparison
equal deleted inserted replaced
14508:7336a81d18c4 14509:80f715651c4c
3136 3136
3137 if (*name == NUL) /* Some stat()s don't flag "" as an error. */ 3137 if (*name == NUL) /* Some stat()s don't flag "" as an error. */
3138 return FALSE; 3138 return FALSE;
3139 if (stat((char *)name, &statb)) 3139 if (stat((char *)name, &statb))
3140 return FALSE; 3140 return FALSE;
3141 #ifdef _POSIX_SOURCE
3142 return (S_ISDIR(statb.st_mode) ? TRUE : FALSE); 3141 return (S_ISDIR(statb.st_mode) ? TRUE : FALSE);
3143 #else
3144 return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE);
3145 #endif
3146 } 3142 }
3147 3143
3148 /* 3144 /*
3149 * return TRUE if "name" is a directory, NOT a symlink to a directory 3145 * return TRUE if "name" is a directory, NOT a symlink to a directory
3150 * return FALSE if "name" is not a directory 3146 * return FALSE if "name" is not a directory
3157 3153
3158 if (*name == NUL) /* Some stat()s don't flag "" as an error. */ 3154 if (*name == NUL) /* Some stat()s don't flag "" as an error. */
3159 return FALSE; 3155 return FALSE;
3160 if (mch_lstat((char *)name, &statb)) 3156 if (mch_lstat((char *)name, &statb))
3161 return FALSE; 3157 return FALSE;
3162 #ifdef _POSIX_SOURCE
3163 return (S_ISDIR(statb.st_mode) ? TRUE : FALSE); 3158 return (S_ISDIR(statb.st_mode) ? TRUE : FALSE);
3164 #else
3165 return ((statb.st_mode & S_IFMT) == S_IFDIR ? TRUE : FALSE);
3166 #endif
3167 } 3159 }
3168 3160
3169 static int executable_file(char_u *name); 3161 static int executable_file(char_u *name);
3170 3162
3171 /* 3163 /*