diff options
author | 2006-01-27 15:26:38 +0000 | |
---|---|---|
committer | 2006-01-27 15:26:38 +0000 | |
commit | 3956f8dacdf6781dcdb8afb283713ec9b5d75191 (patch) | |
tree | 3481bb89fd868309403fb6dab98f15f789deaf71 | |
parent | Use letoh32 to print out configuration descriptors in debug functions. Now (diff) | |
download | wireguard-openbsd-3956f8dacdf6781dcdb8afb283713ec9b5d75191.tar.xz wireguard-openbsd-3956f8dacdf6781dcdb8afb283713ec9b5d75191.zip |
more errors handling cleanup;
-rw-r--r-- | usr.bin/cvs/admin.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/annotate.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/diff.c | 15 | ||||
-rw-r--r-- | usr.bin/cvs/getlog.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/release.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/status.c | 8 | ||||
-rw-r--r-- | usr.bin/cvs/update.c | 19 |
7 files changed, 31 insertions, 39 deletions
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c index 61104af0914..2fdc992e838 100644 --- a/usr.bin/cvs/admin.c +++ b/usr.bin/cvs/admin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: admin.c,v 1.26 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: admin.c,v 1.27 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Joris Vink <joris@openbsd.org> @@ -358,9 +358,9 @@ cvs_admin_local(CVSFILE *cf, void *arg) cvs_rcs_getpath(cf, rcspath, sizeof(rcspath)); - rf = rcs_open(rcspath, RCS_RDWR); - if (rf == NULL) - return (CVS_EX_DATA); + if ((rf = rcs_open(rcspath, RCS_RDWR)) == NULL) + fatal("cvs_admin_local: rcs_open `%s': %s", rcspath, + strerror(rcs_errno)); if (!RCS_KWEXP_INVAL(kflag)) ret = rcs_kwexp_set(rf, kflag); diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c index 797282ebf69..aa80ec8d8be 100644 --- a/usr.bin/cvs/annotate.c +++ b/usr.bin/cvs/annotate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: annotate.c,v 1.27 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: annotate.c,v 1.28 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -170,9 +170,9 @@ cvs_annotate_local(CVSFILE *cf, void *arg) cvs_rcs_getpath(cf, rcspath, sizeof(rcspath)); - rf = rcs_open(rcspath, RCS_READ); - if (rf == NULL) - return (CVS_EX_DATA); + if ((rf = rcs_open(rcspath, RCS_READ)) == NULL) + fatal("cvs_annotate_local: rcs_open `%s': %s", rcspath, + strerror(rcs_errno)); cvs_printf("Annotations for %s", cf->cf_name); cvs_printf("\n***************\n"); diff --git a/usr.bin/cvs/diff.c b/usr.bin/cvs/diff.c index 1f26faffd80..3fce160672d 100644 --- a/usr.bin/cvs/diff.c +++ b/usr.bin/cvs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.77 2006/01/25 11:13:18 xsa Exp $ */ +/* $OpenBSD: diff.c,v 1.78 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -572,10 +572,9 @@ cvs_diff_local(CVSFILE *cf, void *arg) /* at this point, the file is modified */ cvs_rcs_getpath(cf, rcspath, sizeof(rcspath)); - rf = rcs_open(rcspath, RCS_READ); - if (rf == NULL) { - return (CVS_EX_DATA); - } + if ((rf = rcs_open(rcspath, RCS_READ)) == NULL) + fatal("cvs_diff_local: rcs_open `%s': %s", rcspath, + strerror(rcs_errno)); cvs_printf("Index: %s\n%s\nRCS file: %s\n", diff_file, RCS_DIFF_DIV, rcspath); @@ -583,10 +582,8 @@ cvs_diff_local(CVSFILE *cf, void *arg) if (dap->rev1 == NULL) r1 = cf->cf_lrev; else { - if ((r1 = rcsnum_parse(dap->rev1)) == NULL) { - rcs_close(rf); - return (CVS_EX_DATA); - } + if ((r1 = rcsnum_parse(dap->rev1)) == NULL) + fatal("cvs_diff_local: rcsnum_parse failed"); } cvs_printf("retrieving revision %s\n", diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c index 14c1f083b94..1b1a8c22e4e 100644 --- a/usr.bin/cvs/getlog.c +++ b/usr.bin/cvs/getlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getlog.c,v 1.51 2006/01/02 08:11:56 xsa Exp $ */ +/* $OpenBSD: getlog.c,v 1.52 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -223,9 +223,9 @@ cvs_getlog_local(CVSFILE *cf, void *arg) return (0); } - rf = rcs_open(rcspath, RCS_READ); - if (rf == NULL) - return (CVS_EX_DATA); + if ((rf = rcs_open(rcspath, RCS_READ)) == NULL) + fatal("cvs_getlog_local: rcs_open `%s': %s", rcspath, + strerror(rcs_errno)); cvs_printf("\nRCS file: %s", rcspath); cvs_printf("\nWorking file: %s", cf->cf_name); diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c index 0779c859d5f..21aa4abb231 100644 --- a/usr.bin/cvs/release.c +++ b/usr.bin/cvs/release.c @@ -1,4 +1,4 @@ -/* $OpenBSD: release.c,v 1.30 2006/01/27 12:45:21 xsa Exp $ */ +/* $OpenBSD: release.c,v 1.31 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -169,7 +169,7 @@ cvs_release_dir(CVSFILE *cf, void *arg) l = snprintf(updcmd, sizeof(updcmd), "%s %s %s update", __progname, UPDCMD_FLAGS, root->cr_str); if (l == -1 || l >= (int)sizeof(updcmd)) - return (CVS_EX_DATA); + fatal("cvs_release_dir: `cvs update' command string overflow"); /* XXX we should try to avoid a new connection ... */ cvs_log(LP_TRACE, "cvs_release_dir() popen(%s,r)", updcmd); diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 2e8a07af83f..306a8569f57 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.52 2006/01/25 08:15:05 xsa Exp $ */ +/* $OpenBSD: status.c,v 1.53 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> @@ -172,9 +172,9 @@ cvs_status_local(CVSFILE *cf, void *arg) rf = NULL; if (cf->cf_cvstat != CVS_FST_UNKNOWN && cf->cf_cvstat != CVS_FST_ADDED) { - rf = rcs_open(rcspath, RCS_READ); - if (rf == NULL) - return (CVS_EX_DATA); + if ((rf = rcs_open(rcspath, RCS_READ)) == NULL) + fatal("cvs_status_local: rcs_open `%s': %s", rcspath, + strerror(rcs_errno)); } buf[0] = '\0'; diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index 6ef8f1bde3a..f42a945bece 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.53 2006/01/06 16:41:15 reyk Exp $ */ +/* $OpenBSD: update.c,v 1.54 2006/01/27 15:26:38 xsa Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -250,7 +250,7 @@ cvs_update_local(CVSFILE *cf, void *arg) fpath); if (cvs_checkout_rev(NULL, NULL, cf, fpath, islocal, CHECKOUT_REV_REMOVED) < 0) - return (CVS_EX_FILE); + fatal("cvs_update_local: cvs_checkout_rev failed"); return (CVS_EX_OK); } } else { @@ -261,20 +261,15 @@ cvs_update_local(CVSFILE *cf, void *arg) /* set keyword expansion */ /* XXX look at cf->cf_opts as well for this */ - if (rcs_kwexp_set(rf, kflag) < 0) { - rcs_close(rf); - return (CVS_EX_DATA); - } + if (rcs_kwexp_set(rf, kflag) < 0) + fatal("cvs_update_local: rcs_kwexp_set failed"); /* fill in the correct revision */ if (rev != NULL) { - if ((frev = rcsnum_parse(rev)) == NULL) { - rcs_close(rf); - return (CVS_EX_DATA); - } - } else { + if ((frev = rcsnum_parse(rev)) == NULL) + fatal("cvs_update_local: rcsnum_parse failed"); + } else frev = rf->rf_head; - } /* * Compare the headrevision with the revision we currently have. |