=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/remove.c,v retrieving revision 1.34 retrieving revision 1.35 diff -c -r1.34 -r1.35 *** src/usr.bin/cvs/remove.c 2005/08/12 06:36:14 1.34 --- src/usr.bin/cvs/remove.c 2005/08/22 11:17:26 1.35 *************** *** 1,4 **** ! /* $OpenBSD: remove.c,v 1.34 2005/08/12 06:36:14 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * Copyright (c) 2004, 2005 Xavier Santolaria --- 1,4 ---- ! /* $OpenBSD: remove.c,v 1.35 2005/08/22 11:17:26 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * Copyright (c) 2004, 2005 Xavier Santolaria *************** *** 26,31 **** --- 26,32 ---- */ #include + #include #include #include *************** *** 148,155 **** --- 149,158 ---- { int existing, l, removed; char buf[MAXPATHLEN], fpath[MAXPATHLEN]; + CVSENTRIES *entf; existing = removed = 0; + entf = (CVSENTRIES *)cf->cf_entry; if (cf->cf_type == DT_DIR) { if (verbosity > 1) *************** *** 175,183 **** cf->cf_name); return (0); } else if (cf->cf_cvstat == CVS_FST_ADDED) { - /* XXX scratch it from CVS/Entries */ - l = snprintf(buf, sizeof(buf), "%s/%s%s", CVS_PATH_CVSDIR, cf->cf_name, CVS_DESCR_FILE_EXT); if (l == -1 || l >= (int)sizeof(buf)) { --- 178,186 ---- cf->cf_name); return (0); } else if (cf->cf_cvstat == CVS_FST_ADDED) { + if (cvs_ent_remove(entf, cf->cf_name) == -1) + return (CVS_EX_FILE); l = snprintf(buf, sizeof(buf), "%s/%s%s", CVS_PATH_CVSDIR, cf->cf_name, CVS_DESCR_FILE_EXT); if (l == -1 || l >= (int)sizeof(buf)) { *************** *** 185,190 **** --- 188,194 ---- cvs_log(LP_ERRNO, "%s", buf); return (CVS_EX_DATA); } + if (cvs_unlink(buf) == -1) return (CVS_EX_FILE); *************** *** 235,245 **** --- 239,254 ---- static int cvs_remove_file(const char *fpath) { + struct stat st; + /* if -f option is used, physically remove the file */ if (force_remove == 1) { if(cvs_unlink(fpath) == -1) return (-1); nuked++; + } else { + if ((stat(fpath, &st) == -1) && (errno == ENOENT)) + nuked++; } return (0);