blob: 43143fd41b81f9070f5149c59d23eff25a80bd1f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// SPDX-License-Identifier: EUPL-1.2+
// SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>
#include <fcntl.h>
[[gnu::fd_arg(1)]]
int clear_cloexec(int fd)
{
int flags = fcntl(fd, F_GETFD);
if (flags == -1)
return -1;
return fcntl(fd, F_SETFD, flags & ~FD_CLOEXEC);
}
|