aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbb/appletlib.c5
-rw-r--r--win32/process.c7
2 files changed, 6 insertions, 6 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 733d9ca12..ec6ad7ba8 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -993,9 +993,10 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar
993 993
994#if ENABLE_PLATFORM_MINGW32 994#if ENABLE_PLATFORM_MINGW32
995 { 995 {
996 char *var = xasprintf("BB_APPLET_%d=%s", getpid(), applet_name); 996 char var[64];
997
998 sprintf(var, "BB_APPLET_%d=%s", getpid(), applet_name);
997 putenv(var); 999 putenv(var);
998 free(var);
999 } 1000 }
1000#endif 1001#endif
1001 1002
diff --git a/win32/process.c b/win32/process.c
index 95508264b..de8f653c5 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -361,7 +361,7 @@ mingw_spawn(char **argv)
361{ 361{
362 intptr_t ret; 362 intptr_t ret;
363 363
364 ret = mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, environ); 364 ret = mingw_spawn_proc((const char **)argv);
365 365
366 return ret == -1 ? -1 : GetProcessId((HANDLE)ret); 366 return ret == -1 ? -1 : GetProcessId((HANDLE)ret);
367} 367}
@@ -479,13 +479,12 @@ UNUSED_PARAM
479 comm = applet_name; 479 comm = applet_name;
480 } 480 }
481 else { 481 else {
482 char *name, *value; 482 char name[32], *value;
483 483
484 name = xasprintf("BB_APPLET_%d", sp->pid); 484 sprintf(name, "BB_APPLET_%d", sp->pid);
485 if ((value=getenv(name)) != NULL) { 485 if ((value=getenv(name)) != NULL) {
486 comm = value; 486 comm = value;
487 } 487 }
488 free(name);
489 } 488 }
490 safe_strncpy(sp->comm, comm, COMM_LEN); 489 safe_strncpy(sp->comm, comm, COMM_LEN);
491 return sp; 490 return sp;