From b21546ddbea20447054e60c893b64849f54be7d9 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 14 Sep 2024 08:59:46 +0100 Subject: make: fix test for include with no pathnames In POSIX 2024 the behaviour of an include line with no pathnames is unspecified. The test for this condition was incorrect in certain circumstances. Files containing dependencies may be generated by the compiler and included in the makefile. On an initial build no dependency files will be present and the include line is made to ignore errors. In this case the test for no pathnames returned true, even though many pathnames may have been present. Fix the problem by always setting 'makefile' even if the named file can't be opened. --- miscutils/make.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miscutils/make.c b/miscutils/make.c index 1e7b77ddb..bd3b23f21 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -2083,11 +2083,11 @@ input(FILE *fd, int ilevel) make(newname(p), 1); opts &= ~OPT_include; } + makefile = p; if ((ifd = fopen(p, "r")) == NULL) { if (!minus) error("can't open include file '%s'", p); } else { - makefile = p; input(ifd, ilevel + 1); fclose(ifd); } -- cgit v1.2.3-55-g6feb