From 150f50b6732f1d76a2214dee3e880819f63510fe Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Sat, 16 May 2015 16:52:45 +0000 Subject: [PATCH] Fix pcre2grep compile with -std=c99. --- ChangeLog | 3 +++ src/pcre2grep.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2e6af1..6665ac0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 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 --------------------------- diff --git a/src/pcre2grep.c b/src/pcre2grep.c index 9aa3fcb..4bf3187 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -581,7 +581,7 @@ isdirectory(char *filename) struct stat statbuf; if (stat(filename, &statbuf) < 0) 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 * @@ -618,7 +618,7 @@ isregfile(char *filename) struct stat statbuf; if (stat(filename, &statbuf) < 0) 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); }