]> granicus.if.org Git - file/commitdiff
Print error when compile fails, and turn warnings on while compiling so
authorChristos Zoulas <christos@zoulas.com>
Wed, 8 Oct 2003 17:09:26 +0000 (17:09 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 8 Oct 2003 17:09:26 +0000 (17:09 +0000)
we can see what is wrong.

src/file.c

index 5a69f1654fefd2b77bb92b51cd7f65e2bb5c42c8..2a262f87b27a1514a8db4ce497537491c251eba7 100644 (file)
@@ -72,7 +72,7 @@
 #include "patchlevel.h"
 
 #ifndef        lint
-FILE_RCSID("@(#)$Id: file.c,v 1.82 2003/10/08 16:37:27 christos Exp $")
+FILE_RCSID("@(#)$Id: file.c,v 1.83 2003/10/08 17:09:26 christos Exp $")
 #endif /* lint */
 
 
@@ -272,7 +272,7 @@ main(int argc, char *argv[])
        switch(action) {
        case FILE_CHECK:
        case FILE_COMPILE:
-               magic = magic_open(flags);
+               magic = magic_open(flags|MAGIC_CHECK);
                if (magic == NULL) {
                        (void)fprintf(stderr, "%s: %s\n", progname,
                            strerror(errno));
@@ -280,7 +280,12 @@ main(int argc, char *argv[])
                }
                c = action == FILE_CHECK ? magic_check(magic, magicfile) :
                    magic_compile(magic, magicfile);
-               return c == -1 ? 1 : 0;
+               if (c == -1) {
+                       (void)fprintf(stderr, "%s: %s\n", progname,
+                           magic_error(magic));
+                       return -1;
+               }
+               return 0;
        default:
                load(magicfile, flags);
                break;