Skip to content

When execvpe is not available, emulate it by assigning to environ

Jiří Paleček requested to merge jpalecek/kcrash:execvpe-missing into master

Oh well. As the last attempt to get the build on FreeBSD succeed failed on missing execvpe, this MR attempts to fix it by emulating execvpe by execvp with setting environ to a custom value. This is used in software, eg. here, so it should work even on freebsd.

Thinking about it, this begs the question: Do we really need execvpe? We run drknoqi, whose absolute location we look up ourselves in the system path. Then we run the crashing app, whose absolute location should be known as well. Maybe execve would be sufficient.

This potentially leaks the original memory that was in environ. However as we only do it just before exec, this is not an issue.

Edited by Jiří Paleček

Merge request reports