mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Added missing bracers in native code
Contributed by STMicroelectronics Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
parent
6ffa02911a
commit
54ebddc01c
6 changed files with 8 additions and 4 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -54,8 +54,9 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DIR *dirp = opendir(FD_DIR);
|
DIR *dirp = opendir(FD_DIR);
|
||||||
if (dirp == NULL)
|
if (dirp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
struct dirent *direntp;
|
struct dirent *direntp;
|
||||||
|
|
||||||
|
@ -75,8 +76,9 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) {
|
||||||
|
|
||||||
static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
|
static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
|
||||||
int fdlimit = sysconf(_SC_OPEN_MAX);
|
int fdlimit = sysconf(_SC_OPEN_MAX);
|
||||||
if (fdlimit == -1)
|
if (fdlimit == -1) {
|
||||||
fdlimit = 65535; // arbitrary default, just in case
|
fdlimit = 65535; // arbitrary default, just in case
|
||||||
|
}
|
||||||
for (int fd = from_fd_inclusive; fd < fdlimit; fd++) {
|
for (int fd = from_fd_inclusive; fd < fdlimit; fd++) {
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -84,10 +86,12 @@ static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
|
||||||
|
|
||||||
static void close_all_fds() {
|
static void close_all_fds() {
|
||||||
unsigned int from_fd = STDERR_FILENO + 1;
|
unsigned int from_fd = STDERR_FILENO + 1;
|
||||||
if (sys_close_range_wrapper(from_fd) == 0)
|
if (sys_close_range_wrapper(from_fd) == 0) {
|
||||||
return;
|
return;
|
||||||
if (close_all_fds_using_parsing(from_fd) == 0)
|
}
|
||||||
|
if (close_all_fds_using_parsing(from_fd) == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
close_all_fds_fallback(from_fd);
|
close_all_fds_fallback(from_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue