summaryrefslogtreecommitdiff
path: root/lib/Support/Windows
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2011-12-13 23:16:49 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2011-12-13 23:16:49 +0000
commitb92cb30cf547bf9a8590a981a49040f480c8eb82 (patch)
treefc2accf7bb61ca5179758404fefeb418e1a2aed0 /lib/Support/Windows
parentfaebf11a3468767bb702b8e9fca98237f1d3a126 (diff)
downloadllvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.tar.gz
llvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.tar.bz2
llvm-b92cb30cf547bf9a8590a981a49040f480c8eb82.tar.xz
Support/Program: Make Change<stream>ToBinary return error_code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows')
-rw-r--r--lib/Support/Windows/Program.inc18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/Support/Windows/Program.inc b/lib/Support/Windows/Program.inc
index b328b3c290..80ccaa6ea6 100644
--- a/lib/Support/Windows/Program.inc
+++ b/lib/Support/Windows/Program.inc
@@ -397,19 +397,25 @@ Program::Kill(std::string* ErrMsg) {
return false;
}
-bool Program::ChangeStdinToBinary(){
+error_code Program::ChangeStdinToBinary(){
int result = _setmode( _fileno(stdin), _O_BINARY );
- return result == -1;
+ if (result == -1)
+ return error_code(errno, generic_category());
+ return make_error_code(errc::success);
}
-bool Program::ChangeStdoutToBinary(){
+error_code Program::ChangeStdoutToBinary(){
int result = _setmode( _fileno(stdout), _O_BINARY );
- return result == -1;
+ if (result == -1)
+ return error_code(errno, generic_category());
+ return make_error_code(errc::success);
}
-bool Program::ChangeStderrToBinary(){
+error_code Program::ChangeStderrToBinary(){
int result = _setmode( _fileno(stderr), _O_BINARY );
- return result == -1;
+ if (result == -1)
+ return error_code(errno, generic_category());
+ return make_error_code(errc::success);
}
}