From a2a7993548dd1b866d01ce788399e82d57027256 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sat, 19 Jul 2008 14:32:21 +0000 Subject: [PATCH] don't eat trailing \n. --- src/softmagic.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/softmagic.c b/src/softmagic.c index 64de03e9..bdd1c302 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -38,7 +38,7 @@ #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.117 2008/03/01 22:21:49 rrt Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.118 2008/07/16 18:00:57 christos Exp $") #endif /* lint */ private int match(struct magic_set *, struct magic *, uint32_t, @@ -664,9 +664,12 @@ mconvert(struct magic_set *ms, struct magic *m) /* Null terminate and eat *trailing* return */ p->s[sizeof(p->s) - 1] = '\0'; +#if 0 + /* Why? breaks magic numbers that end with \xa */ len = strlen(p->s); if (len-- && p->s[len] == '\n') p->s[len] = '\0'; +#endif return 1; } case FILE_PSTRING: { @@ -677,9 +680,12 @@ mconvert(struct magic_set *ms, struct magic *m) while (len--) *ptr1++ = *ptr2++; *ptr1 = '\0'; +#if 0 + /* Why? breaks magic numbers that end with \xa */ len = strlen(p->s); if (len-- && p->s[len] == '\n') p->s[len] = '\0'; +#endif return 1; } case FILE_BESHORT: -- 2.40.0