From 81d96c214a9cc9ce9af7f48558db635db53a6062 Mon Sep 17 00:00:00 2001 From: Tom Almeida <tommoa256@gmail.com> Date: Fri, 16 Mar 2018 20:47:32 +0800 Subject: [PATCH] Ran formatting for freopen() --- src/stdio/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs index 4748fdfb3..8c291ca28 100644 --- a/src/stdio/src/lib.rs +++ b/src/stdio/src/lib.rs @@ -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); -- GitLab