2
0
mirror of git://sourceware.org/git/glibc.git synced 2025-04-12 14:21:18 +08:00

hurd: Fix fexecve

* sysdeps/mach/hurd/fexecve.c (fexecve): Re-lookup fd with O_EXEC before
calling _hurd_exec_paths.
This commit is contained in:
Samuel Thibault 2020-05-28 23:28:07 +00:00
parent cc0118983a
commit 6544999083

@ -25,10 +25,23 @@
int
fexecve (int fd, char *const argv[], char *const envp[])
{
error_t err = HURD_DPORT_USE (fd, _hurd_exec_paths (__mach_task_self (),
port, NULL, NULL,
argv, envp));
file_t file;
error_t err;
enum retry_type doretry;
char retryname[1024];
err = HURD_DPORT_USE (fd,
__dir_lookup (port, "", O_EXEC, 0, &doretry, retryname, &file));
if (! err && (doretry != FS_RETRY_NORMAL || retryname[0] != '\0'))
err = EGRATUITOUS;
if (err)
return __hurd_fail(err);
err = _hurd_exec_paths (__mach_task_self (), file, NULL, NULL, argv, envp);
if (! err)
err = EGRATUITOUS;
__mach_port_deallocate (__mach_task_self (), file);
return __hurd_fail (err);
}