aboutsummaryrefslogtreecommitdiffstats
path: root/guts/dup2.c
blob: 59d5293e3c952097284bd9f7b8f04e6006b9e294 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
 * static int
 * wrap_dup2(int oldfd, int newfd) {
 *	int rc = -1;
 */
	int save_errno;

	/* close existing one first - this also causes the socket to the
	 * server to get moved around if someone tries to overwrite it. */
	pseudo_debug(2, "dup2: %d->%d\n", oldfd, newfd);
	pseudo_client_op(OP_CLOSE, newfd, -1, 0, 0);
	rc = real_dup2(oldfd, newfd);
	save_errno = errno;
	pseudo_client_op(OP_DUP, oldfd, newfd, 0, 0);
	errno = save_errno;

/*	return rc;
 * }
 */