version 1.27, 2004/11/16 21:03:43 |
version 1.28, 2004/11/26 16:23:50 |
|
|
static FILE *cvs_server_inlog = NULL; |
static FILE *cvs_server_inlog = NULL; |
static FILE *cvs_server_outlog = NULL; |
static FILE *cvs_server_outlog = NULL; |
|
|
|
static pid_t cvs_subproc_pid; |
|
|
|
|
/* |
/* |
* cvs_connect() |
* cvs_connect() |
* |
* |
|
|
cvs_connect(struct cvsroot *root) |
cvs_connect(struct cvsroot *root) |
{ |
{ |
int argc, infd[2], outfd[2], errfd[2]; |
int argc, infd[2], outfd[2], errfd[2]; |
pid_t pid; |
|
char *argv[16], *cvs_server_cmd, *vresp; |
char *argv[16], *cvs_server_cmd, *vresp; |
|
|
if (pipe(infd) == -1) { |
if (pipe(infd) == -1) { |
|
|
return (-1); |
return (-1); |
} |
} |
|
|
pid = fork(); |
cvs_subproc_pid = fork(); |
if (pid == -1) { |
if (cvs_subproc_pid == -1) { |
cvs_log(LP_ERRNO, "failed to fork for cvs server connection"); |
cvs_log(LP_ERRNO, "failed to fork for cvs server connection"); |
return (-1); |
return (-1); |
} |
} |
if (pid == 0) { |
else if (cvs_subproc_pid == 0) { |
if ((dup2(infd[0], STDIN_FILENO) == -1) || |
if ((dup2(infd[0], STDIN_FILENO) == -1) || |
(dup2(outfd[1], STDOUT_FILENO) == -1)) { |
(dup2(outfd[1], STDOUT_FILENO) == -1)) { |
cvs_log(LP_ERRNO, |
cvs_log(LP_ERRNO, |
|
|
int |
int |
cvs_senddir(struct cvsroot *root, CVSFILE *dir) |
cvs_senddir(struct cvsroot *root, CVSFILE *dir) |
{ |
{ |
char buf[MAXPATHLEN]; |
char lbuf[MAXPATHLEN], rbuf[MAXPATHLEN]; |
|
|
if (dir->cf_ddat->cd_repo == NULL) |
if (dir->cf_ddat->cd_repo == NULL) |
strlcpy(buf, root->cr_dir, sizeof(buf)); |
strlcpy(rbuf, root->cr_dir, sizeof(rbuf)); |
else |
else |
snprintf(buf, sizeof(buf), "%s/%s", root->cr_dir, |
snprintf(rbuf, sizeof(rbuf), "%s/%s", root->cr_dir, |
dir->cf_ddat->cd_repo); |
dir->cf_ddat->cd_repo); |
|
|
if ((cvs_sendreq(root, CVS_REQ_DIRECTORY, dir->cf_path) < 0) || |
cvs_file_getpath(dir, lbuf, sizeof(lbuf)); |
(cvs_sendln(root, buf) < 0)) |
|
|
if ((cvs_sendreq(root, CVS_REQ_DIRECTORY, lbuf) < 0) || |
|
(cvs_sendln(root, rbuf) < 0)) |
return (-1); |
return (-1); |
|
|
return (0); |
return (0); |