From f941749af15974163b2af2cf5aa89ecd2db12cf6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 30 Apr 2016 21:10:29 +0000 Subject: Replace regex match string in results (some new magic entries use this). --- usr.bin/file/magic-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'usr.bin/file') diff --git a/usr.bin/file/magic-test.c b/usr.bin/file/magic-test.c index 6beffe8ffc4..1101de18f1e 100644 --- a/usr.bin/file/magic-test.c +++ b/usr.bin/file/magic-test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: magic-test.c,v 1.16 2016/02/20 15:29:37 nicm Exp $ */ +/* $OpenBSD: magic-test.c,v 1.17 2016/04/30 21:10:28 nicm Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -936,8 +936,10 @@ magic_test_type_regex(struct magic_line *ml, struct magic_state *ms) result = (regexec(&re, ms->base, 1, &m, REG_STARTEND) == 0); if (result == !ml->test_not) { - if (ml->result != NULL) - magic_add_result(ms, ml, "%s", ""); + if (ml->result != NULL) { + magic_add_string(ms, ml, ms->base + m.rm_so, + m.rm_eo - m.rm_so); + } if (result) { if (sflag) ms->offset = m.rm_so; -- cgit v1.2.3