From 969dd0f45c20fdafddf510ec9a798a317c46613b Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 25 Apr 2015 21:17:09 +0000 Subject: [PATCH] Only print MIME warnings when warnings are enabled. --- usr.bin/file/magic-load.c | 14 +++++++++----- 1 file 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 @@ -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); -- 2.20.1