summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1995-08-15 20:38:00 +0000
committerpeter <peter@FreeBSD.org>1995-08-15 20:38:00 +0000
commit8c03fe0f4db1526151e5a3607d650f1555f4b68f (patch)
tree62870c5cb2c05a77f694ab13a5e887dd4940b9e8 /gnu
parent339901776f2dcaebd69d610f114664ddfae6cac5 (diff)
downloadFreeBSD-src-8c03fe0f4db1526151e5a3607d650f1555f4b68f.zip
FreeBSD-src-8c03fe0f4db1526151e5a3607d650f1555f4b68f.tar.gz
This changes two things when importing an unreadable file:
1: It stops invalid files being created in the cvs tree 2: It stops the import from aborting without mailing a commit message.. The first is simple, it opens the file for reading before touching the repository, and the second catches the pieces when it hits an unreadable file rather than just aborting mid-way through, leaving the repository in a bit mess. Reviewed by: rgrimes
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/cvs/cvs/import.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gnu/usr.bin/cvs/cvs/import.c b/gnu/usr.bin/cvs/cvs/import.c
index 5452eff..f0a8f72 100644
--- a/gnu/usr.bin/cvs/cvs/import.c
+++ b/gnu/usr.bin/cvs/cvs/import.c
@@ -753,8 +753,19 @@ add_rcs_file (message, rcs, user, vtag, targc, targv)
if (noexec)
return (0);
- fprcs = open_file (rcs, "w+");
- fpuser = open_file (user, "r");
+ /* open the user file first, before we change the RCS files... */
+ fpuser = fopen (user, "r");
+ if (fpuser == NULL) {
+ /* not fatal, continue the import */
+ fperror (logfp, 0, errno, "ERROR: cannot read file %s", user);
+ error (0, errno, "ERROR: cannot read file %s", user);
+ goto read_error;
+ }
+ fprcs = fopen (rcs, "w+");
+ if (fprcs == NULL) {
+ ierrno = errno;
+ goto write_error_noclose;
+ }
/*
* putadmin()
@@ -908,6 +919,7 @@ write_error_noclose:
fperror (logfp, 0, 0, "ERROR: out of space - aborting");
error (1, 0, "ERROR: out of space - aborting");
}
+read_error:
return (err + 1);
}
OpenPOWER on IntegriCloud