diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2018-04-21 01:02:35 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2018-04-21 01:02:35 +0000 |
commit | f3cf3e593358c2ed25b735c5407c40292049a990 (patch) | |
tree | c6c4fa69f990307e24e256221dabb4b8ba2256dd /usr.bin/grep | |
parent | 69dcf941a42b4a14915869bef673d56236c36a79 (diff) | |
download | src-f3cf3e593358c2ed25b735c5407c40292049a990.tar.gz src-f3cf3e593358c2ed25b735c5407c40292049a990.zip |
bsdgrep: Some light cleanup
There's no point checking for a bunch of file modes if we're not a
practicing believer of DIR_SKIP or DEV_SKIP.
This also reduces some style violations that were particularly ugly looking
when browsing through.
Notes
Notes:
svn path=/head/; revision=332850
Diffstat (limited to 'usr.bin/grep')
-rw-r--r-- | usr.bin/grep/util.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index 965a4138ebb5..7af2155439dc 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -308,14 +308,14 @@ procfile(const char *fn) fn = label != NULL ? label : getstr(1); f = grep_open(NULL); } else { - if (!stat(fn, &sb)) { + if (stat(fn, &sb) == 0) { /* Check if we need to process the file */ s = sb.st_mode & S_IFMT; - if (s == S_IFDIR && dirbehave == DIR_SKIP) + if (dirbehave == DIR_SKIP && s == S_IFDIR) + return (0); + if (devbehave == DEV_SKIP && (s == S_IFIFO || + s == S_IFCHR || s == S_IFBLK || s == S_IFSOCK)) return (0); - if ((s == S_IFIFO || s == S_IFCHR || s == S_IFBLK - || s == S_IFSOCK) && devbehave == DEV_SKIP) - return (0); } f = grep_open(fn); } |