[PATCH v2] Use execveat syscall in fexecve

Andreas Schwab schwab@suse.de
Thu Sep 14 08:05:00 GMT 2017


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.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



More information about the Libc-alpha mailing list