diff options
author | 2003-07-16 19:08:21 +0000 | |
---|---|---|
committer | 2003-07-16 19:08:21 +0000 | |
commit | 1cd2216830a81d6753655107ba5165e3d32aa869 (patch) | |
tree | 78199da1a1515047c076c795460055b7d57c3d6e /usr.bin/grep/grep.c | |
parent | Teach patch how to deal with \ No newline at end of file. (diff) | |
download | wireguard-openbsd-1cd2216830a81d6753655107ba5165e3d32aa869.tar.xz wireguard-openbsd-1cd2216830a81d6753655107ba5165e3d32aa869.zip |
When reallocing pattern, use sizeof(*pattern) not sizeof(int).
Fixes a problem on sparc64 where sizeof(int) != sizeof(pointer).
Based on a patch from Brian Poole; tedu@ OK
Diffstat (limited to 'usr.bin/grep/grep.c')
-rw-r--r-- | usr.bin/grep/grep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index 729d1a42408..d7c1e0e2ef0 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grep.c,v 1.21 2003/07/14 23:22:35 millert Exp $ */ +/* $OpenBSD: grep.c,v 1.22 2003/07/16 19:08:21 millert Exp $ */ /*- * Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav @@ -167,7 +167,7 @@ add_pattern(char *pat, size_t len) } if (patterns == pattern_sz) { pattern_sz *= 2; - pattern = grep_realloc(pattern, ++pattern_sz * sizeof(int)); + pattern = grep_realloc(pattern, ++pattern_sz * sizeof(*pattern)); } if (pat[len - 1] == '\n') --len; @@ -432,7 +432,7 @@ main(int argc, char *argv[]) else if (Fflag) cflags |= REG_NOSPEC; fg_pattern = grep_malloc(patterns * sizeof(*fg_pattern)); - r_pattern = grep_malloc(patterns * sizeof(regex_t)); + r_pattern = grep_malloc(patterns * sizeof(*r_pattern)); for (i = 0; i < patterns; ++i) { /* Check if cheating is allowed */ if (fastcomp(&fg_pattern[i], pattern[i])) { |