From 77455f9795385d07e95a1f88ff598121d978ab8b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 10 Feb 2011 14:54:18 -0800 Subject: [PATCH] Read the pipe directly in stap_system_read * util.cxx (stap_system_read): Use gnu's stdio_filebuf to read directly from the pipe file descriptor. --- util.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/util.cxx b/util.cxx index 01f20594e..fe4d5c038 100644 --- a/util.cxx +++ b/util.cxx @@ -24,6 +24,7 @@ #include #include #include +#include extern "C" { #include @@ -40,6 +41,7 @@ extern "C" { } using namespace std; +using namespace __gnu_cxx; // Return current users home directory or die. @@ -525,11 +527,9 @@ stap_system_read(int verbose, const string& command, ostream& out) spawned_pids.insert(child); // read everything from the child - string readpath = "/proc/self/fd/" + lex_cast(pfd[0]); - ifstream in(readpath.c_str()); - close(pfd[0]); + stdio_filebuf in(pfd[0], ios_base::in); close(pfd[1]); - out << in.rdbuf(); + out << ∈ return stap_waitpid(verbose, child); } -- 2.43.5