shithub: neatroff

Download patch

ref: ab1ca71421da19c3df6bd8cb28991d9ab0c4ebaa
parent: de1797c960ebf9b726a84bfe5216c36bdfaba018
author: Ali Gholami Rudi <[email protected]>
date: Mon Dec 8 11:41:20 EST 2014

in: report when neatroff cannot open a file

Reported by Blake McBride <[email protected]>.

--- a/in.c
+++ b/in.c
@@ -46,13 +46,15 @@
 void in_so(char *path)
 {
 	FILE *fin = path && path[0] ? fopen(path, "r") : stdin;
-	if (fin) {
-		in_new();
-		buf->fin = fin;
-		buf->lnum = 1;
-		if (path)
-			snprintf(buf->path, sizeof(buf->path), "%s", path);
+	if (!fin) {
+		errmsg("neatroff: failed to open <%s>\n", path);
+		return;
 	}
+	in_new();
+	buf->fin = fin;
+	buf->lnum = 1;
+	if (path)
+		snprintf(buf->path, sizeof(buf->path), "%s", path);
 }
 
 void in_lf(char *path, int lnum)