summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/cvs/add.c6
-rw-r--r--usr.bin/cvs/checkout.c5
-rw-r--r--usr.bin/cvs/client.c4
-rw-r--r--usr.bin/cvs/diff.c14
-rw-r--r--usr.bin/cvs/file.c28
-rw-r--r--usr.bin/cvs/remote.c9
-rw-r--r--usr.bin/cvs/remove.c6
-rw-r--r--usr.bin/cvs/status.c7
-rw-r--r--usr.bin/cvs/update.c8
9 files changed, 49 insertions, 38 deletions
diff --git a/usr.bin/cvs/add.c b/usr.bin/cvs/add.c
index 7a35b25c979..d8800314942 100644
--- a/usr.bin/cvs/add.c
+++ b/usr.bin/cvs/add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: add.c,v 1.106 2009/01/02 00:11:01 canacar Exp $ */
+/* $OpenBSD: add.c,v 1.107 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -438,7 +438,7 @@ add_file(struct cvs_file *cf)
if (cf->file_rcs == NULL) {
cvs_log(LP_NOTICE, "cannot resurrect %s; "
"RCS file removed by second party", cf->file_name);
- } else if (cf->fd == -1) {
+ } else if (!(cf->file_flags & FILE_ON_DISK)) {
add_entry(cf);
/* Restore the file. */
@@ -469,7 +469,7 @@ add_file(struct cvs_file *cf)
"(instead of dead revision %s)",
cf->file_path, revbuf);
added++;
- } else if (cf->fd != -1) {
+ } else if (cf->file_flags & FILE_ON_DISK) {
cvs_log(LP_NOTICE, "scheduling file '%s' for addition",
cf->file_path);
added++;
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 98e51c08edb..61db978e3ef 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.158 2009/02/21 13:44:18 joris Exp $ */
+/* $OpenBSD: checkout.c,v 1.159 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -494,7 +494,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
(void)unlink(cf->file_path);
if (!(co_flags & CO_MERGE)) {
- if (cf->fd != -1) {
+ if (cf->file_flags & FILE_ON_DISK) {
exists = 1;
(void)close(cf->fd);
}
@@ -506,6 +506,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
strerror(errno));
rcs_rev_write_fd(cf->file_rcs, rnum, cf->fd, 0);
+ cf->file_flags |= FILE_ON_DISK;
} else {
cvs_merge_file(cf, (cvs_join_rev1 == NULL));
}
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 895c67e6394..86437372f3c 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.117 2009/02/13 20:50:15 joris Exp $ */
+/* $OpenBSD: client.c,v 1.118 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -519,7 +519,7 @@ cvs_client_sendfile(struct cvs_file *cf)
switch (cf->file_status) {
case FILE_UNKNOWN:
- if (cf->fd != -1)
+ if (cf->file_flags & FILE_ON_DISK)
cvs_client_send_request("Questionable %s",
cf->file_name);
break;
diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c
index 8706786cf4b..c71bd1d1f69 100644
--- a/usr.bin/cvs/diff.c
+++ b/usr.bin/cvs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.144 2008/06/20 14:04:29 tobias Exp $ */
+/* $OpenBSD: diff.c,v 1.145 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -286,10 +286,9 @@ cvs_diff_local(struct cvs_file *cf)
"comparison available", cf->file_path);
return;
}
- if (cf->fd == -1) {
- if (!cvs_server_active)
- cvs_log(LP_ERR, "cannot find %s",
- cf->file_path);
+ if (!(cf->file_flags & FILE_ON_DISK)) {
+ cvs_log(LP_ERR, "cannot find %s",
+ cf->file_path);
return;
}
break;
@@ -306,7 +305,7 @@ cvs_diff_local(struct cvs_file *cf)
}
break;
default:
- if (cvs_server_active != 1 && cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
cvs_log(LP_ERR, "cannot find %s",
cf->file_path);
return;
@@ -457,7 +456,8 @@ cvs_diff_local(struct cvs_file *cf)
fd2 = rcs_rev_write_stmp(cf->file_rcs, diff_rev2, p2, 0);
if (futimes(fd2, tv2) == -1)
fatal("cvs_diff_local: utimes failed");
- } else if (cvs_cmdop == CVS_OP_DIFF && cf->fd != -1 &&
+ } else if (cvs_cmdop == CVS_OP_DIFF &&
+ (cf->file_flags & FILE_ON_DISK) &&
cf->file_ent->ce_status != CVS_ENT_REMOVED) {
if (fstat(cf->fd, &st) == -1)
fatal("fstat failed %s", strerror(errno));
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index d3681b57de9..a9fa201f470 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.251 2009/02/21 13:44:18 joris Exp $ */
+/* $OpenBSD: file.c,v 1.252 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -240,6 +240,9 @@ cvs_file_get_cf(const char *d, const char *f, const char *fpath, int fd,
cf->in_attic = 0;
cf->file_ent = NULL;
+ if (cf->fd != -1)
+ cf->file_flags |= FILE_ON_DISK;
+
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL ||
cvs_server_active == 1)
cvs_validate_directory(cf->file_path);
@@ -660,11 +663,13 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
cf->file_ent = NULL;
if (cf->file_ent != NULL) {
- if (cf->fd != -1 && cf->file_ent->ce_type == CVS_ENT_DIR &&
+ if (cf->file_flags & FILE_ON_DISK &&
+ cf->file_ent->ce_type == CVS_ENT_DIR &&
cf->file_type != CVS_DIR)
fatal("%s is supposed to be a directory, but it is not",
cf->file_path);
- if (cf->fd != -1 && cf->file_ent->ce_type == CVS_ENT_FILE &&
+ if (cf->file_flags & FILE_ON_DISK &&
+ cf->file_ent->ce_type == CVS_ENT_FILE &&
cf->file_type != CVS_FILE)
fatal("%s is supposed to be a file, but it is not",
cf->file_path);
@@ -747,7 +752,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
}
ismodified = rcsdead = 0;
- if (cf->fd != -1 && cf->file_ent != NULL) {
+ if ((cf->file_flags & FILE_ON_DISK) && cf->file_ent != NULL) {
if (fstat(cf->fd, &st) == -1)
fatal("cvs_file_classify: %s", strerror(errno));
@@ -765,7 +770,8 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
if ((server_has_file == 1) || (cf->fd != -1))
cf->file_flags |= FILE_ON_DISK;
- if (ismodified == 1 && cf->fd != -1 && cf->file_rcs != NULL &&
+ if (ismodified == 1 &&
+ (cf->file_flags & FILE_ON_DISK) && cf->file_rcs != NULL &&
cf->file_ent != NULL && !RCSNUM_ISBRANCH(cf->file_ent->ce_rev) &&
cf->file_ent->ce_status != CVS_ENT_ADDED) {
b1 = rcs_rev_getbuf(cf->file_rcs, cf->file_ent->ce_rev, 0);
@@ -803,7 +809,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
*/
if (cf->file_ent == NULL) {
if (cf->file_rcs == NULL) {
- if (cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
cvs_log(LP_NOTICE,
"nothing known about '%s'",
cf->file_path);
@@ -811,7 +817,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
cf->file_status = FILE_UNKNOWN;
} else if (rcsdead == 1 || !(cf->file_flags & FILE_HAS_TAG)) {
- if (cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
cf->file_status = FILE_UPTODATE;
} else if (cvs_cmdop != CVS_OP_ADD) {
cf->file_status = FILE_UNKNOWN;
@@ -827,7 +833,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
switch (cf->file_ent->ce_status) {
case CVS_ENT_ADDED:
- if (cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
if (cvs_cmdop != CVS_OP_REMOVE) {
cvs_log(LP_NOTICE,
"warning: new-born %s has disappeared",
@@ -845,7 +851,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
}
break;
case CVS_ENT_REMOVED:
- if (cf->fd != -1) {
+ if (cf->file_flags & FILE_ON_DISK) {
cvs_log(LP_NOTICE,
"%s should be removed but is still there",
cf->file_path);
@@ -869,7 +875,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
if (cf->file_rcs == NULL || cf->file_rcsrev == NULL ||
rcsdead == 1 || (reset_tag == 1 && cf->in_attic == 1) ||
(notag == 1 && tag != NULL)) {
- if (cf->fd == -1 && server_has_file == 0) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
cvs_log(LP_NOTICE,
"warning: %s's entry exists but"
" is no longer in the repository,"
@@ -899,7 +905,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
} else if (cf->file_rcsrev == NULL) {
cf->file_status = FILE_UNLINK;
} else {
- if (cf->fd == -1 && server_has_file == 0) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
if (cvs_cmdop != CVS_OP_REMOVE) {
cvs_log(LP_NOTICE,
"warning: %s was lost",
diff --git a/usr.bin/cvs/remote.c b/usr.bin/cvs/remote.c
index b3a0f538244..f1ba28eb0ca 100644
--- a/usr.bin/cvs/remote.c
+++ b/usr.bin/cvs/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.24 2008/06/14 03:19:15 joris Exp $ */
+/* $OpenBSD: remote.c,v 1.25 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -263,7 +263,10 @@ cvs_remote_classify_file(struct cvs_file *cf)
cf->file_type = CVS_FILE;
}
- if (cf->fd != -1 && cf->file_ent != NULL) {
+ if (cf->fd != -1)
+ cf->file_flags |= FILE_ON_DISK;
+
+ if ((cf->file_flags & FILE_ON_DISK) && cf->file_ent != NULL) {
if (fstat(cf->fd, &st) == -1)
fatal("cvs_remote_classify_file(%s): %s", cf->file_path,
strerror(errno));
@@ -272,7 +275,7 @@ cvs_remote_classify_file(struct cvs_file *cf)
cf->file_status = FILE_MODIFIED;
else
cf->file_status = FILE_UPTODATE;
- } else if (cf->fd == -1) {
+ } else if (!(cf->file_flags & FILE_ON_DISK)) {
cf->file_status = FILE_UNKNOWN;
}
diff --git a/usr.bin/cvs/remove.c b/usr.bin/cvs/remove.c
index 63f23fb3c4f..5b15a8a0e28 100644
--- a/usr.bin/cvs/remove.c
+++ b/usr.bin/cvs/remove.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remove.c,v 1.79 2008/06/23 20:51:08 ragge Exp $ */
+/* $OpenBSD: remove.c,v 1.80 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
*
@@ -124,7 +124,7 @@ void
cvs_remove_force(struct cvs_file *cf)
{
if (cf->file_type != CVS_DIR) {
- if (cf->fd != -1) {
+ if (cf->file_flags & FILE_ON_DISK) {
if (unlink(cf->file_path) == -1)
fatal("cvs_remove_force: %s", strerror(errno));
(void)close(cf->fd);
@@ -158,7 +158,7 @@ cvs_remove_local(struct cvs_file *cf)
return;
}
- if (cf->fd != -1) {
+ if (cf->file_flags & FILE_ON_DISK) {
if (verbosity > 1)
cvs_log(LP_ERR, "file `%s' still in working directory",
cf->file_name);
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c
index a3b67c8dfa2..b288954a144 100644
--- a/usr.bin/cvs/status.c
+++ b/usr.bin/cvs/status.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: status.c,v 1.90 2009/02/21 12:47:19 joris Exp $ */
+/* $OpenBSD: status.c,v 1.91 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org>
@@ -134,7 +134,8 @@ cvs_status_local(struct cvs_file *cf)
return;
}
- if (cf->file_status == FILE_UPTODATE && cf->fd == -1 &&
+ if (cf->file_status == FILE_UPTODATE &&
+ !(cf->file_flags & FILE_ON_DISK) &&
!(cf->file_flags & FILE_USER_SUPPLIED))
return;
@@ -154,7 +155,7 @@ cvs_status_local(struct cvs_file *cf)
cf->file_ent->ce_conflict != NULL)
status = "File had conflicts on merge";
- if (cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
(void)xsnprintf(buf, sizeof(buf), "no file %s\t",
cf->file_name);
} else
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 75f22360013..b4cf0f98c84 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.156 2008/06/28 13:10:02 joris Exp $ */
+/* $OpenBSD: update.c,v 1.157 2009/02/21 14:50:53 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -525,7 +525,7 @@ update_has_conflict_markers(struct cvs_file *cf)
cvs_log(LP_TRACE, "update_has_conflict_markers(%s)", cf->file_path);
- if (cf->fd == -1 || cf->file_ent == NULL)
+ if (!(cf->file_flags & FILE_ON_DISK) || cf->file_ent == NULL)
return (0);
bp = cvs_buf_load_fd(cf->fd);
@@ -642,7 +642,7 @@ update_join_file(struct cvs_file *cf)
}
if (rev1 == NULL || !strcmp(state1, RCS_STATE_DEAD)) {
- if (cf->fd != -1) {
+ if (cf->file_flags & FILE_ON_DISK) {
cvs_printf("%s exists but has been added in %s\n",
cf->file_path, jrev2);
} else {
@@ -656,7 +656,7 @@ update_join_file(struct cvs_file *cf)
if (!rcsnum_cmp(rev1, rev2, 0))
goto out;
- if (cf->fd == -1) {
+ if (!(cf->file_flags & FILE_ON_DISK)) {
cvs_printf("%s does not exist but is present in %s\n",
cf->file_path, jrev2);
goto out;