From 9c45d9ad13fdf439d44d7443ae75da15ea0223ed Mon Sep 17 00:00:00 2001 From: Sam Varshavchik Date: Mon, 19 Aug 2013 16:39:41 -0400 Subject: Initial checkin Imported from subversion report, converted to git. Updated all paths in scripts and makefiles, reflecting the new directory hierarchy. --- maildrop/pipefds.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 maildrop/pipefds.h (limited to 'maildrop/pipefds.h') diff --git a/maildrop/pipefds.h b/maildrop/pipefds.h new file mode 100644 index 0000000..1077114 --- /dev/null +++ b/maildrop/pipefds.h @@ -0,0 +1,35 @@ +#ifndef pipefds_h +#define pipefds_h + + +///////////////////////////////////////////////////////////////////////// +// +// Convenience class - automatically destroy pair of pipe handles. +// +///////////////////////////////////////////////////////////////////////// + +#include "config.h" +#include +#if HAVE_UNISTD_H +#include +#endif + +class PipeFds { +public: + int fds[2]; + + PipeFds() { fds[0]= -1; fds[1]= -1; } + int Pipe(); + void close0() + { + if (fds[0] >= 0) close(fds[0]); + fds[0]= -1; + } + void close1() + { + if (fds[1] >= 0) close(fds[1]); + fds[1]= -1; + } + ~PipeFds(); +} ; +#endif -- cgit v1.2.3