]> granicus.if.org Git - file/commitdiff
don't print \012- separators in the same magic entry if it consists of multiple
authorChristos Zoulas <christos@zoulas.com>
Fri, 27 Mar 2009 22:42:49 +0000 (22:42 +0000)
committerChristos Zoulas <christos@zoulas.com>
Fri, 27 Mar 2009 22:42:49 +0000 (22:42 +0000)
print statemens.

src/softmagic.c

index 02ad1fdf6606b46f2e936a8abcdd1a268ec5f4bf..88f5214500db6bd13c933be49396c49473c29e9d 100644 (file)
@@ -32,7 +32,7 @@
 #include "file.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.134 2009/03/10 20:52:50 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.135 2009/03/27 22:42:49 christos Exp $")
 #endif /* lint */
 
 #include "magic.h"
@@ -256,11 +256,14 @@ match(struct magic_set *ms, struct magic *magic, uint32_t nmagic,
                                 * make sure that we have a separator first.
                                 */
                                if (*m->desc) {
-                                       printed_something = 1;
                                        if ((e = handle_annotation(ms, m)) != 0)
                                                return e;
-                                       if (print_sep(ms, firstline) == -1)
-                                               return -1;
+                                       if (!printed_something) {
+                                               printed_something = 1;
+                                               if (print_sep(ms, firstline)
+                                                   == -1)
+                                                       return -1;
+                                       }
                                }
                                /*
                                 * This continuation matched.  Print