[util] Fix lstat feature test macro

dev
Nick Terrell 2018-09-28 15:08:15 -07:00
parent 43146d8a16
commit 09231dad4d
1 changed files with 2 additions and 0 deletions

View File

@ -324,6 +324,7 @@ UTIL_STATIC U32 UTIL_isDirectory(const char* infilename)
UTIL_STATIC U32 UTIL_isLink(const char* infilename) UTIL_STATIC U32 UTIL_isLink(const char* infilename)
{ {
/* macro guards, as defined in : https://linux.die.net/man/2/lstat */ /* macro guards, as defined in : https://linux.die.net/man/2/lstat */
#ifndef __STRICT_ANSI__
#if defined(_BSD_SOURCE) \ #if defined(_BSD_SOURCE) \
|| (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)) \ || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)) \
|| (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) \ || (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) \
@ -333,6 +334,7 @@ UTIL_STATIC U32 UTIL_isLink(const char* infilename)
stat_t statbuf; stat_t statbuf;
r = lstat(infilename, &statbuf); r = lstat(infilename, &statbuf);
if (!r && S_ISLNK(statbuf.st_mode)) return 1; if (!r && S_ISLNK(statbuf.st_mode)) return 1;
#endif
#endif #endif
(void)infilename; (void)infilename;
return 0; return 0;