aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/make.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/miscutils/make.c b/miscutils/make.c
index 970919ddc..cc35d89eb 100644
--- a/miscutils/make.c
+++ b/miscutils/make.c
@@ -742,7 +742,10 @@ setmacro(const char *name, const char *val, int level)
742 // If not defined, allocate space for new 742 // If not defined, allocate space for new
743 unsigned int bucket; 743 unsigned int bucket;
744 744
745 if (!valid && !is_valid_macro(name)) 745 if (!valid && !is_valid_macro(name)) {
746 // Silently drop invalid names from the environment
747 if (level == 3)
748 return;
746#if ENABLE_FEATURE_MAKE_POSIX 749#if ENABLE_FEATURE_MAKE_POSIX
747 error("invalid macro name '%s'%s", name, 750 error("invalid macro name '%s'%s", name,
748 potentially_valid_macro(name) ? 751 potentially_valid_macro(name) ?
@@ -750,6 +753,7 @@ setmacro(const char *name, const char *val, int level)
750#else 753#else
751 error("invalid macro name '%s'", name); 754 error("invalid macro name '%s'", name);
752#endif 755#endif
756 }
753 757
754 bucket = getbucket(name); 758 bucket = getbucket(name);
755 mp = xzalloc(sizeof(struct macro)); 759 mp = xzalloc(sizeof(struct macro));
@@ -2929,7 +2933,7 @@ int make_main(int argc UNUSED_PARAM, char **argv)
2929 } 2933 }
2930 2934
2931 // Process macro definitions from the environment 2935 // Process macro definitions from the environment
2932 process_macros(environ, 3 | M_VALID); 2936 process_macros(environ, 3);
2933 2937
2934 // Update MAKEFLAGS and environment 2938 // Update MAKEFLAGS and environment
2935 update_makeflags(); 2939 update_makeflags();