On Mon, 27 Jan 2025, Nadav Tasher wrote:
Signed-off-by: Nadav Tasher <[email protected]>
---
loginutils/adduser.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/loginutils/adduser.c b/loginutils/adduser.c
index d3c795afa..d9f682389 100644
--- a/loginutils/adduser.c
+++ b/loginutils/adduser.c
@@ -158,8 +158,12 @@ static void passwd_wrapper(const char *login_name)
NORETURN;
static void passwd_wrapper(const char *login_name)
{
- BB_EXECLP("passwd", "passwd", "--", login_name, NULL);
- bb_simple_error_msg_and_die("can't execute passwd, you must set password
manually");
+ char* passwd_argv[4];
Hi, Nadav
The dominant style in the project seems to be char *v, not char* v.
+ passwd_argv[0] = (char *) "passwd";
+ passwd_argv[1] = (char *) "--";
+ passwd_argv[2] = (char *) login_name;
+ passwd_argv[3] = NULL;
The type of a string literal is already char *, so the first two don't need
the cast. You could even write it more compactly, like this:
char *passwd_argv[] = { "passwd", "--", (char *)login_name, NULL };
+ BB_EXECVP_or_die(passwd_argv);
This appears to lose the message text "can't execute passwd,". That seems bad.
Perhaps aim for something like:
BB_EXECVP_or_die_msg(passwd_argv, "can't execute passwd, you must set
password manually");
--
Could you please also consider combining the large number of similar,
small change messages into one topical commit/email? That way they can be
conveniently addressed together.
Thanks,
David
_______________________________________________
busybox mailing list
[email protected]
https://lists.busybox.net/mailman/listinfo/busybox