diff --git a/src/fd.hpp b/src/fd.hpp index 7cb343f..48ac48b 100644 --- a/src/fd.hpp +++ b/src/fd.hpp @@ -15,15 +15,11 @@ int with_stdin_at(int fd, F && what) { quickscope_wrapper stdin_saved_deleter{[=] { close(stdin_saved); }}; dup2(fd, 0); - clearerr(stdin); - if(int ret = what()) { - dup2(stdin_saved, 0); - return ret; - } + int ret = what(); dup2(stdin_saved, 0); - return 0; + return ret; } /// with_len may not exceed pipe capacity (64k by default)