Hi, In make(1), setenv() was mostly called through a wrapper function esetenv() which exits on error. When setting MAKEBASEDIRECTORY the return value of setenv() was not checked. Converting the call to esetenv() makes it more consistent. The third param of setenv(), overwrite, doesn't matter here. The result of getenv() is checked first so nothing is written over.
- Michael Index: main.c =================================================================== RCS file: /cvs/src/usr.bin/make/main.c,v retrieving revision 1.122 diff -u -p -u -r1.122 main.c --- main.c 20 Apr 2017 03:04:11 -0000 1.122 +++ main.c 21 Aug 2017 08:17:07 -0000 @@ -713,7 +713,7 @@ main(int argc, char **argv) basedirectory = getenv("MAKEBASEDIRECTORY"); if (basedirectory == NULL) - setenv("MAKEBASEDIRECTORY", d.current, 0); + esetenv("MAKEBASEDIRECTORY", d.current); MainParseArgs(argc, argv);