From 09ae0229c37ca57fc4da6221edb6b9069575e0f4 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 22 Jul 2016 00:19:19 -0300 Subject: [PATCH] sch2fig/main.c (read_file): be civil and report errors --- sch2fig/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sch2fig/main.c b/sch2fig/main.c index 87dfeba..310eaf4 100644 --- a/sch2fig/main.c +++ b/sch2fig/main.c @@ -40,6 +40,10 @@ static void read_file(const char *name, void *ctx, char *nl; file = fopen(name, "r"); + if (!file) { + perror(name); + exit(1); + } while (fgets(buf, sizeof(buf), file)) { nl = strchr(buf, '\n'); if (nl)