Skip to content
Snippets Groups Projects
Commit 81d96c21 authored by Tom Almeida's avatar Tom Almeida
Browse files

Ran formatting for freopen()

parent 8d404240
No related branches found
No related tags found
1 merge request!85Added functions for stdio.h
......@@ -320,7 +320,8 @@ pub unsafe extern "C" fn freopen(
flockfile(stream);
helpers::fflush_unlocked(stream);
if filename.is_null() { // Reopen stream in new mode
if filename.is_null() {
// Reopen stream in new mode
if flags & fcntl::O_CLOEXEC > 0 {
fcntl::sys_fcntl((*stream).fd, fcntl::F_SETFD, fcntl::FD_CLOEXEC);
}
......@@ -339,7 +340,9 @@ pub unsafe extern "C" fn freopen(
}
if (*new).fd == (*stream).fd {
(*new).fd = -1;
} else if platform::dup2((*new).fd, (*stream).fd) < 0 || fcntl::sys_fcntl((*stream).fd, fcntl::F_SETFL, flags&fcntl::O_CLOEXEC) < 0 {
} else if platform::dup2((*new).fd, (*stream).fd) < 0
|| fcntl::sys_fcntl((*stream).fd, fcntl::F_SETFL, flags & fcntl::O_CLOEXEC) < 0
{
fclose(new);
funlockfile(stream);
fclose(stream);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment