summaryrefslogtreecommitdiff
path: root/src/load.c
diff options
context:
space:
mode:
authorDmitry Goncharov <dgoncharov@users.sf.net>2022-09-10 22:42:28 -0400
committerPaul Smith <psmith@gnu.org>2022-09-10 22:42:28 -0400
commit77734be2af9bf7f99d4014e26e6505c37f8012cf (patch)
treec174ac3fe6884628d1a9486f603cf125d30c318b /src/load.c
parent820210ab8508955130a7618195ad8abb53c8171d (diff)
downloadmake-git-77734be2af9bf7f99d4014e26e6505c37f8012cf.tar.gz
[SV 63044] load: Update .LOADED if the setup function returns -1
* src/load.c (load_file): Update .LOADED if setup returns non-0. * tests/scripts/features/load: Change the return value based on an environment variable. Ensure that returning -1 still adds to .LOADED. Also add a test that verifies that make doesn't try to rebuild the loaded file if -1 is returned.
Diffstat (limited to 'src/load.c')
-rw-r--r--src/load.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/load.c b/src/load.c
index 263eb357..701ca4da 100644
--- a/src/load.c
+++ b/src/load.c
@@ -211,8 +211,9 @@ load_file (const floc *flocp, const char **ldname, int noerror)
/* Invoke the symbol. */
r = (*symp) (flocp);
- /* If it succeeded, add the load file to the loaded variable. */
- if (r > 0)
+ /* If it succeeded, add the load file to the loaded variable.
+ Anything other than 0, including -1, is a success. */
+ if (r)
{
size_t loadlen = strlen (loaded);
char *newval = alloca (loadlen + strlen (*ldname) + 2);