diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-01-06 16:41:16 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-01-06 16:41:16 +0000 |
commit | bdeaf53e793367a03638f3862daea49c791160a4 (patch) | |
tree | 4de7f76f2e8f844e1549d8cad117e319ce68ea73 /usr.bin/cvs | |
parent | 176ee3476ab30441834445d8c2b5b79db3b2dd0c (diff) |
ingore local update of newly added files. this fixes some possible
NULL pointer conditions and also removes some obsolete extra checks.
ok joris@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/update.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 601aede823d..6ef8f1bde3a 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.52 2006/01/06 16:34:47 reyk Exp $ */ +/* $OpenBSD: update.c,v 1.53 2006/01/06 16:41:15 reyk Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -253,21 +253,23 @@ cvs_update_local(CVSFILE *cf, void *arg) return (CVS_EX_FILE); return (CVS_EX_OK); } + } else { + /* There's no need to update a newly added file */ + cvs_printf("A %s\n", fpath); + return (CVS_EX_OK); } /* set keyword expansion */ /* XXX look at cf->cf_opts as well for this */ if (rcs_kwexp_set(rf, kflag) < 0) { - if (rf != NULL) - rcs_close(rf); + rcs_close(rf); return (CVS_EX_DATA); } /* fill in the correct revision */ if (rev != NULL) { if ((frev = rcsnum_parse(rev)) == NULL) { - if (rf != NULL) - rcs_close(rf); + rcs_close(rf); return (CVS_EX_DATA); } } else { @@ -277,7 +279,7 @@ cvs_update_local(CVSFILE *cf, void *arg) /* * Compare the headrevision with the revision we currently have. */ - if (rf != NULL && cf->cf_lrev != NULL) + if (cf->cf_lrev != NULL) revdiff = rcsnum_cmp(cf->cf_lrev, frev, 0); switch (cf->cf_cvstat) { @@ -308,9 +310,6 @@ cvs_update_local(CVSFILE *cf, void *arg) cvs_printf("M %s\n", fpath); } break; - case CVS_FST_ADDED: - cvs_printf("A %s\n", fpath); - break; case CVS_FST_REMOVED: cvs_printf("R %s\n", fpath); break; @@ -337,8 +336,7 @@ cvs_update_local(CVSFILE *cf, void *arg) if ((frev != NULL) && (frev != rf->rf_head)) rcsnum_free(frev); - if (rf != NULL) - rcs_close(rf); + rcs_close(rf); return (CVS_EX_OK); } |