=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/Attic/proto.c,v retrieving revision 1.19 retrieving revision 1.20 diff -c -r1.19 -r1.20 *** src/usr.bin/cvs/Attic/proto.c 2004/08/04 13:26:02 1.19 --- src/usr.bin/cvs/Attic/proto.c 2004/08/05 13:24:37 1.20 *************** *** 1,4 **** ! /* $OpenBSD: proto.c,v 1.19 2004/08/04 13:26:02 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: proto.c,v 1.20 2004/08/05 13:24:37 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. *************** *** 194,200 **** int cvs_connect(struct cvsroot *root) { ! int argc, infd[2], outfd[2]; pid_t pid; char *argv[16], *cvs_server_cmd, *vresp; --- 194,200 ---- int cvs_connect(struct cvsroot *root) { ! int argc, infd[2], outfd[2], errfd[2]; pid_t pid; char *argv[16], *cvs_server_cmd, *vresp; *************** *** 212,217 **** --- 212,227 ---- return (-1); } + if (pipe(errfd) == -1) { + cvs_log(LP_ERRNO, + "failed to create error pipe for client connection"); + (void)close(infd[0]); + (void)close(infd[1]); + (void)close(outfd[0]); + (void)close(outfd[1]); + return (-1); + } + pid = fork(); if (pid == -1) { cvs_log(LP_ERRNO, "failed to fork for cvs server connection"); *************** *** 219,231 **** } if (pid == 0) { if ((dup2(infd[0], STDIN_FILENO) == -1) || ! (dup2(outfd[1], STDOUT_FILENO) == -1)) { cvs_log(LP_ERRNO, "failed to setup standard streams for cvs server"); return (-1); } (void)close(infd[1]); (void)close(outfd[0]); argc = 0; argv[argc++] = cvs_rsh; --- 229,243 ---- } if (pid == 0) { if ((dup2(infd[0], STDIN_FILENO) == -1) || ! (dup2(outfd[1], STDOUT_FILENO) == -1) || ! (dup2(errfd[1], STDERR_FILENO) == -1)) { cvs_log(LP_ERRNO, "failed to setup standard streams for cvs server"); return (-1); } (void)close(infd[1]); (void)close(outfd[0]); + (void)close(errfd[0]); argc = 0; argv[argc++] = cvs_rsh; *************** *** 238,244 **** cvs_server_cmd = getenv("CVS_SERVER"); if (cvs_server_cmd == NULL) ! cvs_server_cmd = "cvs"; argv[argc++] = root->cr_host; argv[argc++] = cvs_server_cmd; --- 250,256 ---- cvs_server_cmd = getenv("CVS_SERVER"); if (cvs_server_cmd == NULL) ! cvs_server_cmd = CVS_SERVER_DEFAULT; argv[argc++] = root->cr_host; argv[argc++] = cvs_server_cmd; *************** *** 253,258 **** --- 265,271 ---- /* we are the parent */ (void)close(infd[0]); (void)close(outfd[1]); + (void)close(errfd[1]); root->cr_srvin = fdopen(infd[1], "w"); if (root->cr_srvin == NULL) { *************** *** 263,268 **** --- 276,287 ---- root->cr_srvout = fdopen(outfd[0], "r"); if (root->cr_srvout == NULL) { cvs_log(LP_ERRNO, "failed to create pipe stream"); + return (-1); + } + + root->cr_srverr = fdopen(errfd[0], "r"); + if (root->cr_srverr == NULL) { + cvs_log(LP_ERR, "failed to create pipe stream"); return (-1); }