45bf891e1d8d rtnl: add module documentation 8bbf01215ce3 nl80211: add module documentation 40a6aeb698e1 nl80211: add new attribute "mlo_links" for per link information 376e8733609e ubus: complete pending requests when disconnecting locally 32449bfb69d6 io: add ptsname, tcgetattr, tcsetattr, grantpt, unlockpt 76bf32679d86 digest: fix jsdoc to reveal sha512 functions 58b4597fa2ae build: drop remnant 6ef0b3ada3fd build: respect bin/lib paths 28132276a426 build: adjust flags and definitions cb1b1c1a097b zlib: make chunk size configurable 6f80655c88c3 debian: refresh packaging 9fc4889c6e8e debian: adjust LTO build a503a49f5cef debian: build "digest" and "zlib" modules ffc48a2a4db9 socket: fix off-by-one in uv_to_sockaddr() Fixes: https://github.com/jow-/ucode/issues/366 dropped patch 130 - integrated at source. refreshed patches https://github.com/openwrt/openwrt/pull/21585 Signed-off-by: Paul Donald <newtwen+github@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21585 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
58 lines
1.5 KiB
Diff
58 lines
1.5 KiB
Diff
From: Felix Fietkau <nbd@nbd.name>
|
|
Date: Wed, 8 Oct 2025 19:11:46 +0200
|
|
Subject: [PATCH] uloop: allow reusing the existing environment
|
|
|
|
When passing null as environment argument, reuse existing environ.
|
|
This makes it possible to avoid having to duplicate and convert it
|
|
by passing the output of getenv().
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
---
|
|
|
|
--- a/lib/uloop.c
|
|
+++ b/lib/uloop.c
|
|
@@ -1023,7 +1023,22 @@ uc_uloop_process(uc_vm_t *vm, size_t nar
|
|
|
|
if (pid == 0) {
|
|
argp = calloc(ucv_array_length(arguments) + 2, sizeof(char *));
|
|
- envp = calloc(ucv_object_length(env_arg) + 1, sizeof(char *));
|
|
+ envp = environ;
|
|
+
|
|
+ if (env_arg) {
|
|
+ envp = calloc(ucv_object_length(env_arg) + 1, sizeof(char *));
|
|
+ i = 0;
|
|
+ ucv_object_foreach(env_arg, envk, envv) {
|
|
+ buf = xprintbuf_new();
|
|
+
|
|
+ ucv_stringbuf_printf(buf, "%s=", envk);
|
|
+ ucv_to_stringbuf(vm, buf, envv, false);
|
|
+
|
|
+ envp[i++] = buf->buf;
|
|
+
|
|
+ free(buf);
|
|
+ }
|
|
+ }
|
|
|
|
if (!argp || !envp)
|
|
_exit(-1);
|
|
@@ -1033,19 +1048,6 @@ uc_uloop_process(uc_vm_t *vm, size_t nar
|
|
for (i = 0; i < ucv_array_length(arguments); i++)
|
|
argp[i+1] = ucv_to_string(vm, ucv_array_get(arguments, i));
|
|
|
|
- i = 0;
|
|
-
|
|
- ucv_object_foreach(env_arg, envk, envv) {
|
|
- buf = xprintbuf_new();
|
|
-
|
|
- ucv_stringbuf_printf(buf, "%s=", envk);
|
|
- ucv_to_stringbuf(vm, buf, envv, false);
|
|
-
|
|
- envp[i++] = buf->buf;
|
|
-
|
|
- free(buf);
|
|
- }
|
|
-
|
|
execvpe((const char *)ucv_string_get(executable),
|
|
(char * const *)argp, (char * const *)envp);
|
|
|