mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Correct formatting of C code (#843)
Apply the coding standards to the C code from #840
This commit is contained in:
parent
f39fa5596a
commit
24d9bd1834
6 changed files with 11 additions and 7 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -57,7 +57,8 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) {
|
|||
#endif
|
||||
|
||||
DIR *dirp = opendir(FD_DIR);
|
||||
if (dirp == NULL) return -1;
|
||||
if (dirp == NULL)
|
||||
return -1;
|
||||
|
||||
struct dirent *direntp;
|
||||
|
||||
|
@ -77,7 +78,8 @@ static int close_all_fds_using_parsing(unsigned int from_fd_inclusive) {
|
|||
|
||||
static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
|
||||
int fdlimit = sysconf(_SC_OPEN_MAX);
|
||||
if (fdlimit == -1) fdlimit = 65535; // arbitrary default, just in case
|
||||
if (fdlimit == -1)
|
||||
fdlimit = 65535; // arbitrary default, just in case
|
||||
for (int fd = from_fd_inclusive; fd < fdlimit; fd++) {
|
||||
close(fd);
|
||||
}
|
||||
|
@ -85,8 +87,10 @@ static void close_all_fds_fallback(unsigned int from_fd_inclusive) {
|
|||
|
||||
static void close_all_fds() {
|
||||
unsigned int from_fd = STDERR_FILENO + 1;
|
||||
if (sys_close_range_wrapper(from_fd) == 0) return;
|
||||
if (close_all_fds_using_parsing(from_fd) == 0) return;
|
||||
if (sys_close_range_wrapper(from_fd) == 0)
|
||||
return;
|
||||
if (close_all_fds_using_parsing(from_fd) == 0)
|
||||
return;
|
||||
close_all_fds_fallback(from_fd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue