[PATCH v2] Use execveat syscall in fexecve

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Sep 14 13:44:00 GMT 2017



On 14/09/2017 05:04, Andreas Schwab wrote:
> On Sep 11 2017, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> I would prefer it to use INLINE_SYSCALL_CALL. And since the idea is not to
>> clobber errno I think we can do:
>>
>> #ifdef __NR_execvat
>>   INTERNAL_SYSCALL_DECL (err);
>>   int val = INTERNAL_SYSCALL_CALL (execveat, fd, argv, envp, AT_EMPTY_PATH);
>>   if (INTERNAL_SYSCALL_ERROR_P (val, err) != ENOSYS)
>>     return -1;
>> #endif
> 
> No, that would be wrong.  Either the exec succeeds, then errno no longer
> exits, otherwise errno needs to be set before we return.
> 
> Andreas.
> 

Right, errno does need to be setup (I misread the man for some reason).



More information about the Libc-alpha mailing list