From 6d9051df32b90c6a4fe6ca1ff9e771b7dfe004fa Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 6 Oct 2011 13:50:45 +0100 Subject: helper: Improve error message when run on random files (thanks Alexey Torkhov). --- helper/appliance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/helper/appliance.c b/helper/appliance.c index b2cc840..c4d0b32 100644 --- a/helper/appliance.c +++ b/helper/appliance.c @@ -284,7 +284,9 @@ add_hostfiles (const char *hostfiles_file, struct writer *writer) if (strchr (hostfile, '*') || strchr (hostfile, '?')) { char *dirname = xstrdup (hostfile); char *patt = strrchr (dirname, '/'); - assert (patt); + if (!patt) + error (EXIT_FAILURE, 0, "%s: line %zu: invalid pattern\n(is this file a supermin appliance hostfiles file?)", + hostfiles_file, i+1); *patt++ = '\0'; char **files = read_dir (dirname); -- cgit