Reputation: 10672
I compiled and ran the following program with TCC under Windows 7 and got an application crash:
#include <process.h>
int main(void)
{
if (execlp("c:\\windows\\system32\\whoami.exe", "c:\\windows\\system32\\whoami.exe") < 0)
perror("error");
return 1;
}
Here are the crash details:
Problem signature:
Problem Event Name: APPCRASH
Application Name: a.exe
Application Version: 0.0.0.0
Application Timestamp: 00000000
Fault Module Name: msvcrt.dll
Fault Module Version: 7.0.7601.17744
Fault Module Timestamp: 4eeaf722
Exception Code: c0000005
Exception Offset: 0005b4fe
OS Version: 6.1.7601.2.1.0.256.1
Locale ID: 1033
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
Why is it happening and how can I solve this?
Upvotes: 0
Views: 723
Reputation: 272687
You forgot to null-terminate your list of arguments to execlp()
.
See e.g. http://linux.die.net/man/3/execlp or http://msdn.microsoft.com/en-us/library/vstudio/1kxct8h0.aspx.
Upvotes: 4