diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-12-06 04:10:07 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-12-06 04:10:07 +0000 |
commit | 3ed22efe68dfb159e0bb0162412d8f916e0ba13c (patch) | |
tree | c07f780492737527f64f4adc02114dfa79a28014 | |
parent | fb2c4f64724f887d5e15d5932addc7c8d1ac7841 (diff) |
implement a saner handler for the Removed and Remove-entry responses.
in the case of Removed, the file will actually be unlinked now.
-rw-r--r-- | usr.bin/cvs/resp.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index f0f25854517..477a5a6e003 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.9 2004/12/03 21:08:40 jfb Exp $ */ +/* $OpenBSD: resp.c,v 1.10 2004/12/06 04:10:06 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -593,7 +593,10 @@ cvs_resp_updated(struct cvsroot *root, int type, char *line) /* * cvs_resp_removed() * - * Handler for the `Removed' and `Remove-entry' responses. + * Handler for the `Removed' and `Remove-entry' responses. The `Removed' + * response is received when both a file and its entry need to be removed from + * the local copy. The `Remove-entry' is received in cases where the file is + * already gone but there is still an entry to remove in the Entries file. */ static int @@ -604,12 +607,19 @@ cvs_resp_removed(struct cvsroot *root, int type, char *line) cvs_splitpath(line, base, sizeof(base), &file); ef = cvs_ent_open(base, O_RDWR); - if (ef == NULL) - return (-1); + if (ef == NULL) { + cvs_log(LP_ERR, "error handling `Removed' response"); + if (type == CVS_RESP_RMENTRY) + return (-1); + } else { + (void)cvs_ent_remove(ef, file); + cvs_ent_close(ef); + } - printf("Received a `Remove' on %s\n", line); - cvs_ent_remove(ef, file); - cvs_ent_close(ef); + if ((type == CVS_RESP_REMOVED) && (unlink(line) == -1)) { + cvs_log(LP_ERRNO, "failed to unlink `%s'", line); + return (-1); + } return (0); } |