File: pipefds.C

package info (click to toggle)
maildrop 0.54a-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 872 kB
  • ctags: 883
  • sloc: cpp: 8,469; ansic: 658; sh: 327; makefile: 82
file content (31 lines) | stat: -rw-r--r-- 1,058 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* DSTART                                                                    */
/*                                                                           */
/*           maildrop - mail delivery agent with filtering abilities         */
/*                                                                           */
/*  Copyright 1998, Double Precision Inc.                                    */
/*                                                                           */
/*  This program is distributed under the terms of the GNU General Public    */
/*  License. See COPYING for additional information.                         */
/* DEND                                                                      */
#include	"pipefds.h"

static const char rcsid[]="$Id: pipefds.C 1.1 1998/04/16 23:53:22 mrsam Exp $";

int PipeFds::Pipe()
{
	close0();
	close1();
	if (pipe(fds) < 0)
	{
		fds[0]= -1;
		fds[1]= -1;	// Just in case
		return (-1);
	}
	return (0);
}

PipeFds::~PipeFds()
{
	if (fds[0] >= 0)	close(fds[0]);
	if (fds[1] >= 0)	close(fds[1]);
}