diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-11 07:18:56 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-11 07:18:56 +0100 |
| commit | 658622eb5e1b81d394f066df44bc9f0abe9cc807 (patch) | |
| tree | a7b3fb997a47cbc6bd134b699bf6181cb74d2f8a /lib/Utils/popen_and_save_output.cpp | |
| parent | b0abdde8871b0366868b917df040a8880165ba30 (diff) | |
| download | abrt-658622eb5e1b81d394f066df44bc9f0abe9cc807.tar.gz abrt-658622eb5e1b81d394f066df44bc9f0abe9cc807.tar.xz abrt-658622eb5e1b81d394f066df44bc9f0abe9cc807.zip | |
RunApp: safer chdir. Overhauled "sparn a child and get its output" in general
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/popen_and_save_output.cpp')
| -rw-r--r-- | lib/Utils/popen_and_save_output.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/lib/Utils/popen_and_save_output.cpp b/lib/Utils/popen_and_save_output.cpp deleted file mode 100644 index 4bcbcac4..00000000 --- a/lib/Utils/popen_and_save_output.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Utility routines. - * - * Licensed under GPLv2 or later, see file COPYING in this tarball for details. - */ -#include "abrtlib.h" - -using namespace std; - -string popen_and_save_output(const char *cmd) -{ - string result; - - FILE *fp = popen(cmd, "r"); - if (fp == NULL) /* fork or pipe failed; or out-of-mem */ - { - return result; - } - - size_t sz; - char buf[BUFSIZ + 1]; - while ((sz = fread(buf, 1, sizeof(buf)-1, fp)) > 0) - { - buf[sz] = '\0'; - result += buf; - } - pclose(fp); - - return result; -} |
