summaryrefslogtreecommitdiffstats
path: root/usr.bin/file
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2016-04-30 21:10:28 +0000
committernicm <nicm@openbsd.org>2016-04-30 21:10:28 +0000
commitf543d3e5cbeccf1badd772c6282d0531c93be39e (patch)
tree34ae777719f02b57279040b155b161fd371dcaaa /usr.bin/file
parenttty_client_ready can not be internal to tty.c again. (diff)
downloadwireguard-openbsd-f543d3e5cbeccf1badd772c6282d0531c93be39e.tar.xz
wireguard-openbsd-f543d3e5cbeccf1badd772c6282d0531c93be39e.zip
Replace regex match string in results (some new magic entries use this).
Diffstat (limited to 'usr.bin/file')
-rw-r--r--usr.bin/file/magic-test.c8
1 files changed, 5 insertions, 3 deletions
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 <nicm@openbsd.org>
@@ -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;