diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2006-05-28 08:49:02 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2006-05-28 08:49:02 +0000 |
commit | 21032fc6ee5b57923405f962dbe3be2fdf22a1d7 (patch) | |
tree | 0fb6ff7f857d3d0bafb73047086092d9984a7a4c /usr.bin/cvs | |
parent | e901a1b5f159ea5d070c07dce51034a1f1be65dc (diff) |
if we run into a file that was suppose to be a directory
or a directory that is suppose to be a file, abort right away
because something bad probably happened.
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/file.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index a52da5e95a4..222dab3fee7 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.143 2006/05/28 07:56:44 joris Exp $ */ +/* $OpenBSD: file.c,v 1.144 2006/05/28 08:49:01 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -569,11 +569,25 @@ cvs_file_classify(struct cvs_file *cf, int loud) cf->file_rpath = xstrdup(rcsfile); cf->file_ent = cvs_ent_get(entlist, cf->file_name); + if (cf->file_ent != NULL) { + if (cf->file_ent->ce_type == CVS_ENT_DIR && + cf->file_type != CVS_DIR) + fatal("%s is suppose to be a directory, but it is not", + cf->file_path); + if (cf->file_ent->ce_type == CVS_ENT_FILE && + cf->file_type != CVS_FILE) + fatal("%s is suppose to be a file, but it is not", + cf->file_path); + } + if (cf->file_type == CVS_DIR) { if (cf->fd == -1 && stat(rcsfile, &st) != -1) cf->file_status = DIR_CREATE; else if (cf->file_ent != NULL) cf->file_status = FILE_UPTODATE; + else + cf->file_status = FILE_UNKNOWN; + xfree(repo); xfree(rcsfile); cvs_ent_close(entlist, ENT_NOSYNC); |