summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2006-10-12 17:20:13 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2006-10-12 17:20:13 +0000
commitbdc4798954792a723add115bc31e25cb3b375e51 (patch)
tree6807a459dd4307aff82ca2f1f7628e71fde674c9
parent44d192008a21f40be662799964b12c429df4c0de (diff)
- convert some warnx() to warn(), which fixes a few stupidly un-informative error messages (found by tom@)
- make rcs_choosefile() save wrt errno, input from ray@ ok joris@ xsa@
-rw-r--r--usr.bin/rcs/co.c4
-rw-r--r--usr.bin/rcs/rcsdiff.c4
-rw-r--r--usr.bin/rcs/rcsmerge.c4
-rw-r--r--usr.bin/rcs/rcsprog.c6
-rw-r--r--usr.bin/rcs/rcsutil.c7
-rw-r--r--usr.bin/rcs/rlog.c4
6 files changed, 15 insertions, 14 deletions
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index b138aed1a0d..ec44738c35f 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.97 2006/08/07 20:55:28 ray Exp $ */
+/* $OpenBSD: co.c,v 1.98 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -150,7 +150,7 @@ checkout_main(int argc, char **argv)
for (i = 0; i < argc; i++) {
fd = rcs_choosefile(argv[i], fpath, sizeof(fpath));
if (fd < 0) {
- warnx("%s", fpath);
+ warn("%s", fpath);
continue;
}
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index 24433d5edee..9c97203235a 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsdiff.c,v 1.70 2006/09/22 13:42:43 jmc Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.71 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -207,7 +207,7 @@ rcsdiff_main(int argc, char **argv)
for (i = 0; i < argc; i++) {
fd = rcs_choosefile(argv[i], fpath, sizeof(fpath));
if (fd < 0) {
- warnx("%s", fpath);
+ warn("%s", fpath);
continue;
}
diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c
index 1bbee41b896..ef69302c01b 100644
--- a/usr.bin/rcs/rcsmerge.c
+++ b/usr.bin/rcs/rcsmerge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsmerge.c,v 1.48 2006/08/11 08:18:19 xsa Exp $ */
+/* $OpenBSD: rcsmerge.c,v 1.49 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -118,7 +118,7 @@ rcsmerge_main(int argc, char **argv)
warnx("warning: excess arguments ignored");
if ((fd = rcs_choosefile(argv[0], fpath, sizeof(fpath))) < 0)
- errx(status, "%s", fpath);
+ err(status, "%s", fpath);
if (!(flags & QUIET))
(void)fprintf(stderr, "RCS file: %s\n", fpath);
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 0c6c45a766c..3b9d32eac6a 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.132 2006/08/16 07:39:15 ray Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.133 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -305,7 +305,7 @@ rcs_main(int argc, char **argv)
for (i = 0; i < argc; i++) {
fd = rcs_choosefile(argv[i], fpath, sizeof(fpath));
if (fd < 0 && !(flags & RCS_CREATE)) {
- warnx("%s", fpath);
+ warn("%s", fpath);
continue;
}
@@ -372,7 +372,7 @@ rcs_main(int argc, char **argv)
ofd = rcs_choosefile(oldfilename, ofpath, sizeof(ofpath));
if (ofd < 0) {
if (!(flags & RCS_CREATE))
- warnx("%s", ofpath);
+ warn("%s", ofpath);
exit(1);
}
if ((oldfile = rcs_open(ofpath, ofd, RCS_READ)) == NULL)
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index 05bcb5413b7..403b5abad55 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.21 2006/09/25 23:58:05 ray Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.22 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -196,9 +196,9 @@ rcs_choosefile(const char *filename, char *out, size_t len)
* This ensures that there is at least one suffix for strsep().
*/
if (strcmp(rcs_suffixes, "") == 0) {
- fd = open(rcspath, O_RDONLY);
if (strlcpy(out, rcspath, len) >= len)
errx(1, "rcs_choosefile: truncation");
+ fd = open(rcspath, O_RDONLY);
return (fd);
}
@@ -259,10 +259,11 @@ rcs_choosefile(const char *filename, char *out, size_t len)
xfree(suffixes);
- fd = open(rcspath, O_RDONLY);
if (strlcpy(out, rcspath, len) >= len)
errx(1, "rcs_choosefile: truncation");
+ fd = open(rcspath, O_RDONLY);
+
return (fd);
}
diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c
index 53898cda822..61007867b43 100644
--- a/usr.bin/rcs/rlog.c
+++ b/usr.bin/rcs/rlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rlog.c,v 1.55 2006/05/27 05:49:14 ray Exp $ */
+/* $OpenBSD: rlog.c,v 1.56 2006/10/12 17:20:12 niallo Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -138,7 +138,7 @@ rlog_main(int argc, char **argv)
for (i = 0; i < argc; i++) {
fd = rcs_choosefile(argv[i], fpath, sizeof(fpath));
if (fd < 0) {
- warnx("%s", fpath);
+ warn("%s", fpath);
continue;
}