diff options
author | Alexander Kabaev <kan@FreeBSD.org> | 2019-10-02 06:15:30 +0000 |
---|---|---|
committer | Alexander Kabaev <kan@FreeBSD.org> | 2019-10-02 06:15:30 +0000 |
commit | c5672dd7b9f14f4a86f918935873acf53a77ba27 (patch) | |
tree | 6a8606e61eda42047db2a25d3af239f3842877e7 /usr.bin/split | |
parent | 5a391b572bdf688c7c4de9a3f57219a7032ae274 (diff) | |
download | src-c5672dd7b9f14f4a86f918935873acf53a77ba27.tar.gz src-c5672dd7b9f14f4a86f918935873acf53a77ba27.zip |
Convert pnmatch to single element array in regexec calls
The regexec function is declared as taking an array of regmatch_t
elements, and passing in the pointer to singleton element, while
correct, triggers a Coverity warning. Convert the singleton into
an array of one to silence the warning.
Reported by: Coverity
Coverity CID: 1009732, 1009733
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=352953
Diffstat (limited to 'usr.bin/split')
-rw-r--r-- | usr.bin/split/split.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/split/split.c b/usr.bin/split/split.c index 9028b29d1c69..46f6ec03a32d 100644 --- a/usr.bin/split/split.c +++ b/usr.bin/split/split.c @@ -281,11 +281,11 @@ split2(void) /* Check if we need to start a new file */ if (pflag) { - regmatch_t pmatch; + regmatch_t pmatch[1]; - pmatch.rm_so = 0; - pmatch.rm_eo = len - 1; - if (regexec(&rgx, bfr, 0, &pmatch, REG_STARTEND) == 0) + pmatch[0].rm_so = 0; + pmatch[0].rm_eo = len - 1; + if (regexec(&rgx, bfr, 0, pmatch, REG_STARTEND) == 0) newfile(); } else if (lcnt++ == numlines) { newfile(); |