[PATCH] crond for no-mmu

Mike Frysinger vapier at gentoo.org
Tue Jan 22 11:38:45 UTC 2008


On Sunday 13 January 2008, Denis Vlasenko wrote:
> ChangeUser(): does setenv, which modifies global environ
> and stuff it points too. This leaks old malloced block
> from old setenv's. This is libc API breakage, not fixable.
>
> If you need to repeatedly set variable,
> don't use setenv. Use something like:
>
> 	if (envvar) {
> 		unsetenv(envvar);
> 		free(envvar);
> 	}
> 	envvar = xasprintf("VAR=%s", val);
> 	putenv(envvar);

perhaps useful as a libbb function ?  or perhaps not since allocation in the 
vfork-ed child will leak into the parent and once the child exec's, the 
parent has no way of reaping that :(
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.busybox.net/pipermail/busybox/attachments/20080122/026042da/attachment-0002.pgp 


More information about the busybox mailing list