[core] compare entire "/bin/sh" "-c" after execve
compare entire "/bin/sh" "-c" strings after execve if execve fails
@@ -786,11 +786,11 @@ pid_t fdevent_fork_execve(const char *name, char *argv[], char *envp[], int fdin
execve(name, argv, envp ? envp : environ);
int errnum = errno;
- if (0 == memcmp(argv[0], "/bin/sh", sizeof("/bin/sh")-1)
- && argv[1] && 0 == memcmp(argv[1], "-c", sizeof("-c")-1))
- perror(argv[2]);
- else
- perror(argv[0]);
+ int argnum =
+ (0 == strcmp(argv[0], "/bin/sh") && argv[1] && 0 == strcmp(argv[1], "-c"))
+ ? 2
+ : 0;
+ perror(argv[argnum]);
_exit(errnum);
#else
