From 9a4fe0bc63f2e98bac0e647e12620929d8658e50 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 6 Oct 2023 11:30:21 +0100 Subject: make: permit Unix-style paths when setting MAKE The 'make' applet follows POSIX requirements when setting the MAKE variable. However, it doesn't allow for the case where argv[0] is of a form like '/bin/make' but no corresponding executable exists. This can happen in busybox-w32 when '/bin/make' is interpreted as a reference to the 'make' applet. In this case set the MAKE variable to argv[0] and avoid issuing a warning. Setting MAKE to something that isn't a real executable is fine so long as it's only used by busybox-w32 applets. If it's used by external applications they may get confused. Adds 16-32 bytes. (GitHub issue #354) --- miscutils/make.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/miscutils/make.c b/miscutils/make.c index 8feec1202..b6103bb58 100644 --- a/miscutils/make.c +++ b/miscutils/make.c @@ -2820,7 +2820,10 @@ int make_main(int argc UNUSED_PARAM, char **argv) path = newpath = xmalloc_realpath(p); free(p); if (!path) { - bb_perror_msg("can't resolve path for %s", argv[0]); + if (unix_path(argv[0])) + path = argv[0]; + else + bb_perror_msg("can't resolve path for %s", argv[0]); } } #else -- cgit v1.2.3-55-g6feb