diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-04-28 16:43:58 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-04-28 16:43:58 +0200 |
commit | 7ad2a3477f39e2eac221c53e5f94954f481eb1b4 (patch) | |
tree | 0c6358e915d40d0eb35df97af408e4e03b0c9ef2 /apt-pkg/contrib/fileutl.h | |
parent | a298a1dc595c548e6c10b48b8e69d987e5be1c42 (diff) |
Implement Popen() execv helper to avoid popen()
Diffstat (limited to 'apt-pkg/contrib/fileutl.h')
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index cc1a98eae..b7812ac56 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -201,4 +201,16 @@ std::string flCombine(std::string Dir,std::string File); // simple c++ glob std::vector<std::string> Glob(std::string const &pattern, int flags=0); +/** \brief Popen() implementation that execv() instead of using a shell + * + * \param Args the execv style command to run + * \param FileFd is a referenz to the FileFd to use for input or output + * \param Child a reference to the integer that stores the child pid + * Note that you must call ExecWait() or similar to cleanup + * \param Mode is either FileFd::ReadOnly or FileFd::WriteOnly + * \return true on success, false on failure with _error set + */ +bool Popen(const char* Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode); + + #endif |