aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/elvis/cmd2.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/elvis/cmd2.c')
-rw-r--r--usr.bin/elvis/cmd2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/elvis/cmd2.c b/usr.bin/elvis/cmd2.c
index 361799f85e9f..25192c0b52da 100644
--- a/usr.bin/elvis/cmd2.c
+++ b/usr.bin/elvis/cmd2.c
@@ -260,9 +260,11 @@ void cmd_substitute(frommark, tomark, cmd, bang, extra)
/* substitute for the matched part */
#ifdef REGEX
- regsub(rm, startp, endp, subst, d);
+ if (regsub(rm, startp, endp, subst, d) < 0)
+ return;
#else
- regsub(re, subst, d);
+ if (regsub(re, subst, d) < 0)
+ return;
#endif
#ifdef REGEX
s = endp;