version 1.38, 2008/06/11 00:47:05 |
version 1.39, 2008/06/19 19:03:25 |
|
|
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <fcntl.h> |
#include <pwd.h> |
#include <pwd.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
|
FILE *fp; |
FILE *fp; |
RCSNUM *hrev; |
RCSNUM *hrev; |
size_t len; |
size_t len; |
|
int fd; |
char *cwd, *p, *rev; |
char *cwd, *p, *rev; |
char revbuf[CVS_REV_BUFSZ], repo[MAXPATHLEN], fpath[MAXPATHLEN]; |
char revbuf[CVS_REV_BUFSZ], repo[MAXPATHLEN], fpath[MAXPATHLEN]; |
char timebuf[CVS_TIME_BUFSZ]; |
char timebuf[CVS_TIME_BUFSZ]; |
|
|
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s", |
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s", |
current_cvsroot->cr_dir, CVS_PATH_HISTORY); |
current_cvsroot->cr_dir, CVS_PATH_HISTORY); |
|
|
if ((fp = fopen(fpath, "a")) != NULL) { |
if ((fd = open(fpath, O_WRONLY|O_APPEND)) == -1) { |
fprintf(fp, "%c%x|%s|%s|%s|%s|%s\n", |
if (errno != ENOENT) |
historytab[type], time(NULL), getlogin(), cwd, repo, |
cvs_log(LP_ERR, "failed to open history file"); |
rev, (cf != NULL) ? cf->file_name : argument); |
|
|
|
(void)fclose(fp); |
|
} else { |
} else { |
cvs_log(LP_ERR, "failed to add entry to history file"); |
if ((fp = fdopen(fd, "a")) != NULL) { |
|
fprintf(fp, "%c%x|%s|%s|%s|%s|%s\n", |
|
historytab[type], time(NULL), getlogin(), cwd, |
|
repo, rev, (cf != NULL) ? cf->file_name : |
|
argument); |
|
(void)fclose(fp); |
|
} else { |
|
cvs_log(LP_ERR, "failed to add entry to history file"); |
|
(void)close(fd); |
|
} |
} |
} |
|
|
if (rev != revbuf) |
if (rev != revbuf) |