summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-04-25 21:17:09 +0000
committernicm <nicm@openbsd.org>2015-04-25 21:17:09 +0000
commit969dd0f45c20fdafddf510ec9a798a317c46613b (patch)
treef5bf26dd9c9892924f42136fe1f4818a6391ebae
parentRepair boot device detection when booting off the second SCSI controller on (diff)
downloadwireguard-openbsd-969dd0f45c20fdafddf510ec9a798a317c46613b.tar.xz
wireguard-openbsd-969dd0f45c20fdafddf510ec9a798a317c46613b.zip
Only print MIME warnings when warnings are enabled.
-rw-r--r--usr.bin/file/magic-load.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/file/magic-load.c b/usr.bin/file/magic-load.c
index 6e9b6835713..9d4480d6a8f 100644
--- a/usr.bin/file/magic-load.c
+++ b/usr.bin/file/magic-load.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: magic-load.c,v 1.3 2015/04/25 18:44:28 nicm Exp $ */
+/* $OpenBSD: magic-load.c,v 1.4 2015/04/25 21:17:09 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -922,13 +922,17 @@ magic_set_mimetype(struct magic *m, u_int at, struct magic_line *ml, char *line)
cp++;
}
if (*mimetype == '\0' || *cp != '\0') {
- fprintf(stderr, "%s:%u: invalid MIME type: %s\n", m->path, at,
- mimetype);
+ if (m->warnings) {
+ fprintf(stderr, "%s:%u: invalid MIME type: %s\n",
+ m->path, at, mimetype);
+ }
return;
}
if (ml == NULL) {
- fprintf(stderr, "%s:%u: stray MIME type: %s\n", m->path, at,
- mimetype);
+ if (m->warnings) {
+ fprintf(stderr, "%s:%u: stray MIME type: %s\n",
+ m->path, at, mimetype);
+ }
return;
}
ml->mimetype = xstrdup(mimetype);