Fix pcre2grep compile with -std=c99.

This commit is contained in:
Philip.Hazel 2015-05-16 16:52:45 +00:00
parent 472d1c4e62
commit 150f50b673
2 changed files with 5 additions and 2 deletions

View File

@ -126,6 +126,9 @@ buffer overflow at compile time. This bug was discovered by the LLVM fuzzer.
31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1 31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1
as an int; fixed by writing it as 1u). as an int; fixed by writing it as 1u).
32. Fix pcre2grep compile when -std=c99 is used with gcc, though it still gives
a warning for "fileno" unless -std=gnu99 us used.
Version 10.10 06-March-2015 Version 10.10 06-March-2015
--------------------------- ---------------------------

View File

@ -581,7 +581,7 @@ isdirectory(char *filename)
struct stat statbuf; struct stat statbuf;
if (stat(filename, &statbuf) < 0) if (stat(filename, &statbuf) < 0)
return 0; /* In the expectation that opening as a file will fail */ return 0; /* In the expectation that opening as a file will fail */
return (statbuf.st_mode & S_IFMT) == S_IFDIR; return S_ISDIR(statbuf.st_mode);
} }
static directory_type * static directory_type *
@ -618,7 +618,7 @@ isregfile(char *filename)
struct stat statbuf; struct stat statbuf;
if (stat(filename, &statbuf) < 0) if (stat(filename, &statbuf) < 0)
return 1; /* In the expectation that opening as a file will fail */ return 1; /* In the expectation that opening as a file will fail */
return (statbuf.st_mode & S_IFMT) == S_IFREG; return S_ISREG(statbuf.st_mode);
} }