[PATCH v8 12/14] httpd: replace execv call with bb_execv and disable FEATURE_HTTPD_CGI when FEATURE_FORCE_APPLETS is enabled

Nadav Tasher tashernadav at gmail.com
Sun Mar 9 23:55:34 UTC 2025


Due to a limit imposed by FEATURE_FORCE_APPLETS, execv is not allowed.
The execv call is required to execute CGI binaries, so it makes
FEATURE_HTTPD_CGI depend on FEATURE_FORCE_APPLET being disabled.

The execv call was changed to bb_execv, mostly for keeping the
codebase consistent, as all applets now use bb_execXX calls.

Signed-off-by: Nadav Tasher <tashernadav at gmail.com>
---
 networking/httpd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/networking/httpd.c b/networking/httpd.c
index ddcb03bca..6c047b9b6 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -154,7 +154,7 @@
 //config:config FEATURE_HTTPD_CGI
 //config:	bool "Support Common Gateway Interface (CGI)"
 //config:	default y
-//config:	depends on HTTPD
+//config:	depends on HTTPD && !FEATURE_FORCE_APPLETS
 //config:	help
 //config:	This option allows scripts and executables to be invoked
 //config:	when specific URLs are requested.
@@ -1705,8 +1705,10 @@ static void send_cgi_and_exit(
 
 		/* _NOT_ execvp. We do not search PATH. argv[0] is a filename
 		 * without any dir components and will only match a file
-		 * in the current directory */
-		execv(argv[0], argv);
+		 * in the current directory.
+		 * This will not work with FEATURE_FORCE_APPLETS, which is why
+		 * this feature depends on it being disabled. */
+		bb_execv(argv[0], argv);
 		if (verbose)
 			bb_perror_msg("can't execute '%s'", argv[0]);
  error_execing_cgi:
-- 
2.43.0



More information about the busybox mailing list