=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/commit.c,v retrieving revision 1.101 retrieving revision 1.102 diff -c -r1.101 -r1.102 *** src/usr.bin/cvs/commit.c 2007/01/26 21:48:17 1.101 --- src/usr.bin/cvs/commit.c 2007/01/31 21:07:35 1.102 *************** *** 1,4 **** ! /* $OpenBSD: commit.c,v 1.101 2007/01/26 21:48:17 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria --- 1,4 ---- ! /* $OpenBSD: commit.c,v 1.102 2007/01/31 21:07:35 xsa Exp $ */ /* * Copyright (c) 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria *************** *** 209,215 **** BUF *b, *d; int isnew; RCSNUM *head; ! int l, openflags, rcsflags; char rbuf[24], nbuf[24]; CVSENTRIES *entlist; char attic[MAXPATHLEN], repo[MAXPATHLEN], rcsfile[MAXPATHLEN]; --- 209,215 ---- BUF *b, *d; int isnew; RCSNUM *head; ! int openflags, rcsflags; char rbuf[24], nbuf[24]; CVSENTRIES *entlist; char attic[MAXPATHLEN], repo[MAXPATHLEN], rcsfile[MAXPATHLEN]; *************** *** 248,257 **** "to be dead", cf->file_path); cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); ! l = snprintf(rcsfile, MAXPATHLEN, "%s/%s%s", repo, cf->file_name, RCS_FILE_EXT); - if (l == -1 || l >= MAXPATHLEN) - fatal("cvs_commit_local: overflow"); if (rename(cf->file_rpath, rcsfile) == -1) fatal("cvs_commit_local: failed to move %s " --- 248,255 ---- "to be dead", cf->file_path); cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); ! (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s%s", repo, cf->file_name, RCS_FILE_EXT); if (rename(cf->file_rpath, rcsfile) == -1) fatal("cvs_commit_local: failed to move %s " *************** *** 358,374 **** cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); ! l = snprintf(attic, MAXPATHLEN, "%s/%s", repo, CVS_PATH_ATTIC); ! if (l == -1 || l >= MAXPATHLEN) ! fatal("cvs_commit_local: overflow"); if (mkdir(attic, 0755) == -1 && errno != EEXIST) fatal("cvs_commit_local: failed to create Attic"); ! l = snprintf(attic, MAXPATHLEN, "%s/%s/%s%s", repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT); - if (l == -1 || l >= MAXPATHLEN) - fatal("cvs_commit_local: overflow"); if (rename(cf->file_rpath, attic) == -1) fatal("cvs_commit_local: failed to move %s to Attic", --- 356,369 ---- cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN); ! (void)xsnprintf(attic, MAXPATHLEN, "%s/%s", ! repo, CVS_PATH_ATTIC); if (mkdir(attic, 0755) == -1 && errno != EEXIST) fatal("cvs_commit_local: failed to create Attic"); ! (void)xsnprintf(attic, MAXPATHLEN, "%s/%s/%s%s", repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT); if (rename(cf->file_rpath, attic) == -1) fatal("cvs_commit_local: failed to move %s to Attic", *************** *** 425,437 **** commit_desc_set(struct cvs_file *cf) { BUF *bp; ! int l, fd; char desc_path[MAXPATHLEN], *desc; ! l = snprintf(desc_path, MAXPATHLEN, "%s/%s%s", CVS_PATH_CVSDIR, cf->file_name, CVS_DESCR_FILE_EXT); - if (l == -1 || l >= MAXPATHLEN) - fatal("commit_desc_set: overflow"); if ((fd = open(desc_path, O_RDONLY)) == -1) return; --- 420,430 ---- commit_desc_set(struct cvs_file *cf) { BUF *bp; ! int fd; char desc_path[MAXPATHLEN], *desc; ! (void)xsnprintf(desc_path, MAXPATHLEN, "%s/%s%s", CVS_PATH_CVSDIR, cf->file_name, CVS_DESCR_FILE_EXT); if ((fd = open(desc_path, O_RDONLY)) == -1) return;