version 1.56, 2007/01/28 02:04:45 |
version 1.57, 2007/01/31 21:07:35 |
|
|
static void |
static void |
client_check_directory(char *data) |
client_check_directory(char *data) |
{ |
{ |
int l; |
|
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
char entry[CVS_ENT_MAXLINELEN], *parent, *base; |
char entry[CVS_ENT_MAXLINELEN], *parent, *base; |
|
|
|
|
if (!strcmp(parent, ".")) |
if (!strcmp(parent, ".")) |
return; |
return; |
|
|
l = snprintf(entry, CVS_ENT_MAXLINELEN, "D/%s////", base); |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "D/%s////", base); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("client_check_directory: overflow"); |
|
|
|
entlist = cvs_ent_open(parent); |
entlist = cvs_ent_open(parent); |
cvs_ent_add(entlist, entry); |
cvs_ent_add(entlist, entry); |
|
|
void |
void |
cvs_client_sendfile(struct cvs_file *cf) |
cvs_client_sendfile(struct cvs_file *cf) |
{ |
{ |
int l; |
|
size_t len; |
size_t len; |
char rev[16], timebuf[64], sticky[32]; |
char rev[16], timebuf[64], sticky[32]; |
|
|
|
|
|
|
sticky[0] = '\0'; |
sticky[0] = '\0'; |
if (cf->file_ent->ce_tag != NULL) { |
if (cf->file_ent->ce_tag != NULL) { |
l = snprintf(sticky, sizeof(sticky), "T%s", |
(void)xsnprintf(sticky, sizeof(sticky), "T%s", |
cf->file_ent->ce_tag); |
cf->file_ent->ce_tag); |
if (l == -1 || l >= (int)sizeof(sticky)) |
|
fatal("cvs_client_sendfile: overflow"); |
|
} |
} |
|
|
cvs_client_send_request("Entry /%s/%s%s/%s/%s/%s", |
cvs_client_send_request("Entry /%s/%s%s/%s/%s/%s", |
|
|
void |
void |
cvs_client_checkedin(char *data) |
cvs_client_checkedin(char *data) |
{ |
{ |
int l; |
|
CVSENTRIES *entlist; |
CVSENTRIES *entlist; |
struct cvs_ent *ent, *newent; |
struct cvs_ent *ent, *newent; |
char *dir, *e, entry[CVS_ENT_MAXLINELEN], rev[16], timebuf[64]; |
char *dir, *e, entry[CVS_ENT_MAXLINELEN], rev[16], timebuf[64]; |
|
|
timebuf[strlen(timebuf) - 1] = '\0'; |
timebuf[strlen(timebuf) - 1] = '\0'; |
|
|
sticky[0] = '\0'; |
sticky[0] = '\0'; |
if (ent->ce_tag != NULL) { |
if (ent->ce_tag != NULL) |
l = snprintf(sticky, sizeof(sticky), "T%s", ent->ce_tag); |
(void)xsnprintf(sticky, sizeof(sticky), "T%s", ent->ce_tag); |
if (l == -1 || l >= (int)sizeof(sticky)) |
|
fatal("cvs_client_checkedin: overflow"); |
|
} |
|
|
|
l = snprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s%s/%s/%s/%s", |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s%s/%s/%s/%s", |
newent->ce_name, (newent->ce_status == CVS_ENT_REMOVED) ? "-" : "", |
newent->ce_name, (newent->ce_status == CVS_ENT_REMOVED) ? "-" : "", |
rev, timebuf, ent->ce_opts ? ent->ce_opts : "", sticky); |
rev, timebuf, ent->ce_opts ? ent->ce_opts : "", sticky); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("cvs_client_checkedin: overflow"); |
|
|
|
cvs_ent_free(ent); |
cvs_ent_free(ent); |
cvs_ent_free(newent); |
cvs_ent_free(newent); |
|
|
void |
void |
cvs_client_updated(char *data) |
cvs_client_updated(char *data) |
{ |
{ |
int l, fd; |
int fd; |
time_t now; |
time_t now; |
mode_t fmode, mask; |
mode_t fmode, mask; |
size_t flen; |
size_t flen; |
|
|
e = cvs_ent_parse(en); |
e = cvs_ent_parse(en); |
xfree(en); |
xfree(en); |
rcsnum_tostr(e->ce_rev, revbuf, sizeof(revbuf)); |
rcsnum_tostr(e->ce_rev, revbuf, sizeof(revbuf)); |
l = snprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s/%s/", e->ce_name, |
(void)xsnprintf(entry, CVS_ENT_MAXLINELEN, "/%s/%s/%s/%s/", e->ce_name, |
revbuf, timebuf, e->ce_opts ? e->ce_opts : ""); |
revbuf, timebuf, e->ce_opts ? e->ce_opts : ""); |
if (l == -1 || l >= CVS_ENT_MAXLINELEN) |
|
fatal("cvs_client_updated: overflow"); |
|
|
|
cvs_ent_free(e); |
cvs_ent_free(e); |
ent = cvs_ent_open(wdir); |
ent = cvs_ent_open(wdir); |
|
|
static void |
static void |
cvs_client_initlog(void) |
cvs_client_initlog(void) |
{ |
{ |
int l; |
|
u_int i; |
u_int i; |
char *env, *envdup, buf[MAXPATHLEN], fpath[MAXPATHLEN]; |
char *env, *envdup, buf[MAXPATHLEN], fpath[MAXPATHLEN]; |
char rpath[MAXPATHLEN], *s; |
char rpath[MAXPATHLEN], *s; |
|
|
fatal("cvs_client_initlog: truncation"); |
fatal("cvs_client_initlog: truncation"); |
break; |
break; |
case 'p': |
case 'p': |
snprintf(fpath, sizeof(fpath), "%d", getpid()); |
(void)xsnprintf(fpath, sizeof(fpath), "%d", getpid()); |
break; |
break; |
case 'u': |
case 'u': |
if ((pwd = getpwuid(getuid())) != NULL) { |
if ((pwd = getpwuid(getuid())) != NULL) { |
|
|
} |
} |
|
|
for (i = 0; i < UINT_MAX; i++) { |
for (i = 0; i < UINT_MAX; i++) { |
l = snprintf(fpath, sizeof(fpath), "%s-%d.in", rpath, i); |
(void)xsnprintf(fpath, sizeof(fpath), "%s-%d.in", rpath, i); |
if (l == -1 || l >= (int)sizeof(fpath)) |
|
fatal("cvs_client_initlog: overflow"); |
|
|
|
if (stat(fpath, &st) != -1) |
if (stat(fpath, &st) != -1) |
continue; |
continue; |
|
|
} |
} |
|
|
for (i = 0; i < UINT_MAX; i++) { |
for (i = 0; i < UINT_MAX; i++) { |
l = snprintf(fpath, sizeof(fpath), "%s-%d.out", rpath, i); |
(void)xsnprintf(fpath, sizeof(fpath), "%s-%d.out", rpath, i); |
if (l == -1 || l >= (int)sizeof(fpath)) |
|
fatal("cvs_client_initlog: overflow"); |
|
|
|
if (stat(fpath, &st) != -1) |
if (stat(fpath, &st) != -1) |
continue; |
continue; |