summaryrefslogtreecommitdiffstats
path: root/usr.bin/rcs/rcsutil.c
diff options
context:
space:
mode:
authorniallo <niallo@openbsd.org>2006-10-12 17:20:12 +0000
committerniallo <niallo@openbsd.org>2006-10-12 17:20:12 +0000
commit99e6625588f90db1fced9b5a5e9037bac8db9a46 (patch)
treefd2a52d172827f82d0d10b41d922f625656ac403 /usr.bin/rcs/rcsutil.c
parentfix rcsid (diff)
downloadwireguard-openbsd-99e6625588f90db1fced9b5a5e9037bac8db9a46.tar.xz
wireguard-openbsd-99e6625588f90db1fced9b5a5e9037bac8db9a46.zip
- 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@
Diffstat (limited to 'usr.bin/rcs/rcsutil.c')
-rw-r--r--usr.bin/rcs/rcsutil.c7
1 files changed, 4 insertions, 3 deletions
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);
}