version 1.16, 2004/12/10 18:47:38 |
version 1.17, 2004/12/13 17:09:01 |
|
|
static int |
static int |
cvs_resp_updated(struct cvsroot *root, int type, char *line) |
cvs_resp_updated(struct cvsroot *root, int type, char *line) |
{ |
{ |
|
int ret; |
mode_t fmode; |
mode_t fmode; |
char path[MAXPATHLEN], cksum_buf[CVS_CKSUM_LEN]; |
char path[MAXPATHLEN], cksum_buf[CVS_CKSUM_LEN]; |
BUF *fbuf; |
BUF *fbuf; |
|
|
struct cvs_ent *ep; |
struct cvs_ent *ep; |
struct timeval tv[2]; |
struct timeval tv[2]; |
|
|
|
ret = 0; |
STRIP_SLASH(line); |
STRIP_SLASH(line); |
|
|
/* read the remote path of the file */ |
/* read the remote path of the file */ |
|
|
|
|
cvs_ent_close(entfile); |
cvs_ent_close(entfile); |
|
|
fbuf = cvs_recvfile(root, &fmode); |
if ((fbuf = cvs_recvfile(root, &fmode)) == NULL) |
if (fbuf == NULL) |
|
return (-1); |
return (-1); |
|
if (cvs_buf_write(fbuf, path, fmode) < 0) { |
|
cvs_buf_free(fbuf); |
|
return (-1); |
|
} |
|
cvs_buf_free(fbuf); |
|
|
cvs_buf_write(fbuf, path, fmode); |
|
|
|
if (cvs_modtime != CVS_DATE_DMSEC) { |
if (cvs_modtime != CVS_DATE_DMSEC) { |
tv[0].tv_sec = (long)cvs_modtime; |
tv[0].tv_sec = (long)cvs_modtime; |
tv[0].tv_usec = 0; |
tv[0].tv_usec = 0; |
|
|
|
|
/* now see if there is a checksum */ |
/* now see if there is a checksum */ |
if (cvs_fcksum != NULL) { |
if (cvs_fcksum != NULL) { |
if (cvs_cksum(path, cksum_buf, sizeof(cksum_buf)) < 0) { |
if (cvs_cksum(path, cksum_buf, sizeof(cksum_buf)) < 0) |
} |
ret = -1; |
|
else if (strcmp(cksum_buf, cvs_fcksum) != 0) { |
if (strcmp(cksum_buf, cvs_fcksum) != 0) { |
|
cvs_log(LP_ERR, "checksum error on received file"); |
cvs_log(LP_ERR, "checksum error on received file"); |
(void)unlink(line); |
(void)unlink(line); |
|
ret = -1; |
} |
} |
|
|
free(cvs_fcksum); |
free(cvs_fcksum); |
cvs_fcksum = NULL; |
cvs_fcksum = NULL; |
} |
} |
|
|
return (0); |
return (ret); |
} |
} |
|
|
|
|