diff --git a/src/fd.hpp b/src/fd.hpp index 48ac48b..f02a508 100644 --- a/src/fd.hpp +++ b/src/fd.hpp @@ -4,21 +4,21 @@ #pragma once -#include "common.hpp" #include +#include #include template int with_stdin_at(int fd, F && what) { auto stdin_saved = dup(0); - quickscope_wrapper stdin_saved_deleter{[=] { close(stdin_saved); }}; dup2(fd, 0); clearerr(stdin); int ret = what(); dup2(stdin_saved, 0); + close(stdin_saved); return ret; }