diff options
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/ci.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/co.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/diff.c | 26 | ||||
-rw-r--r-- | usr.bin/rcs/diff3.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/rcs.c | 9 | ||||
-rw-r--r-- | usr.bin/rcs/rcsclean.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/rcsdiff.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/rcsmerge.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/rcsnum.c | 9 | ||||
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 6 | ||||
-rw-r--r-- | usr.bin/rcs/rcsutil.c | 8 | ||||
-rw-r--r-- | usr.bin/rcs/rlog.c | 4 | ||||
-rw-r--r-- | usr.bin/rcs/worklist.h | 7 |
13 files changed, 51 insertions, 42 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 1ddaf3392d6..1ec9aeceed1 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.218 2014/10/02 06:23:15 otto Exp $ */ +/* $OpenBSD: ci.c,v 1.219 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -70,7 +70,7 @@ struct checkin_params { RCSFILE *file; RCSNUM *frev, *newrev; const char *description, *symbol; - char fpath[MAXPATHLEN], *rcs_msg, *username, *filename; + char fpath[PATH_MAX], *rcs_msg, *username, *filename; char *author, *state; BUF *deltatext; }; diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c index 1d3cdc5acf4..ce050de96a5 100644 --- a/usr.bin/rcs/co.c +++ b/usr.bin/rcs/co.c @@ -1,4 +1,4 @@ -/* $OpenBSD: co.c,v 1.119 2014/10/10 08:15:25 otto Exp $ */ +/* $OpenBSD: co.c,v 1.120 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -50,7 +50,7 @@ checkout_main(int argc, char **argv) RCSNUM *rev; RCSFILE *file; const char *author, *date, *state; - char fpath[MAXPATHLEN]; + char fpath[PATH_MAX]; char *rev_str, *username; time_t rcs_mtime = -1; diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c index b19dcd1224c..1d0a4577166 100644 --- a/usr.bin/rcs/diff.c +++ b/usr.bin/rcs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.36 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: diff.c,v 1.37 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -64,21 +64,25 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ -#include <sys/param.h> #include <sys/stat.h> #include <ctype.h> #include <err.h> #include <stdarg.h> +#include <stdint.h> #include <stddef.h> #include <stdio.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include "buf.h" #include "diff.h" #include "xmalloc.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) + /* * diff - compare two files. */ @@ -527,7 +531,7 @@ stone(int *a, int n, int *b, int *c, int flags) bound = UINT_MAX; else { sq = isqrt(n); - bound = MAX(256, sq); + bound = MAXIMUM(256, sq); } k = 0; @@ -1200,10 +1204,10 @@ dump_context_vec(FILE *f1, FILE *f2, int flags) return; b = d = 0; /* gcc */ - lowa = MAX(1, cvp->a - diff_context); - upb = MIN(len[0], context_vec_ptr->b + diff_context); - lowc = MAX(1, cvp->c - diff_context); - upd = MIN(len[1], context_vec_ptr->d + diff_context); + lowa = MAXIMUM(1, cvp->a - diff_context); + upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); + lowc = MAXIMUM(1, cvp->c - diff_context); + upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); diff_output("***************"); if ((flags & D_PROTOTYPE)) { @@ -1303,10 +1307,10 @@ dump_unified_vec(FILE *f1, FILE *f2, int flags) return; d = 0; /* gcc */ - lowa = MAX(1, cvp->a - diff_context); - upb = MIN(len[0], context_vec_ptr->b + diff_context); - lowc = MAX(1, cvp->c - diff_context); - upd = MIN(len[1], context_vec_ptr->d + diff_context); + lowa = MAXIMUM(1, cvp->a - diff_context); + upb = MINIMUM(len[0], context_vec_ptr->b + diff_context); + lowc = MAXIMUM(1, cvp->c - diff_context); + upd = MINIMUM(len[1], context_vec_ptr->d + diff_context); diff_output("@@ -"); uni_range(lowa, upb); diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index 9ceae97d302..27b57ea4d91 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.34 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: diff3.c,v 1.35 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -126,7 +126,7 @@ static int last[4]; static int eflag = 3; /* default -E for compatibility with former RCS */ static int oflag = 1; /* default -E for compatibility with former RCS */ static int debug = 0; -static char f1mark[MAXPATHLEN], f3mark[MAXPATHLEN]; /* markers for -E and -X */ +static char f1mark[PATH_MAX], f3mark[PATH_MAX]; /* markers for -E and -X */ static int duplicate(struct range *, struct range *); static int edit(struct diff *, int, int); diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c index cd86d6991a9..4db755e0cdc 100644 --- a/usr.bin/rcs/rcs.c +++ b/usr.bin/rcs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.81 2014/10/10 08:15:25 otto Exp $ */ +/* $OpenBSD: rcs.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -24,6 +24,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <sys/param.h> /* MAXBSIZE */ #include <sys/stat.h> #include <ctype.h> @@ -44,6 +45,8 @@ #include "rcsutil.h" #include "xmalloc.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + /* invalid characters in RCS states */ static const char rcs_state_invch[] = RCS_STATE_INVALCHAR; @@ -981,7 +984,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) /* XXX rcsnum_cmp() is totally broken for * this purpose. */ - numlen = MIN(brev->rn_len, + numlen = MINIMUM(brev->rn_len, rb->rb_num->rn_len - 1); for (i = 0; i < numlen; i++) { if (rb->rb_num->rn_id[i] != @@ -1477,7 +1480,7 @@ rcs_expand_keywords(char *rcsfile_in, struct rcs_delta *rdp, BUF *bp, int mode) { BUF *newbuf; u_char *c, *kw, *fin; - char buf[256], *tmpf, resolved[MAXPATHLEN], *rcsfile; + char buf[256], *tmpf, resolved[PATH_MAX], *rcsfile; u_char *line, *line2; u_int i, j; int kwtype; diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c index 1241e756d21..4bff4894fd4 100644 --- a/usr.bin/rcs/rcsclean.c +++ b/usr.bin/rcs/rcsclean.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsclean.c,v 1.53 2014/10/02 06:23:15 otto Exp $ */ +/* $OpenBSD: rcsclean.c,v 1.54 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -133,7 +133,7 @@ rcsclean_file(char *fname, const char *rev_str) { int fd, match; RCSFILE *file; - char fpath[MAXPATHLEN], numb[RCS_REV_BUFSZ]; + char fpath[PATH_MAX], numb[RCS_REV_BUFSZ]; RCSNUM *rev; BUF *b1, *b2; time_t rcs_mtime = -1; diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c index f508dba3ecf..bd3a3edbdf6 100644 --- a/usr.bin/rcs/rcsdiff.c +++ b/usr.bin/rcs/rcsdiff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsdiff.c,v 1.81 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: rcsdiff.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -51,7 +51,7 @@ rcsdiff_main(int argc, char **argv) int fd, i, ch, dflags, status; RCSNUM *rev1, *rev2; RCSFILE *file; - char fpath[MAXPATHLEN], *rev_str1, *rev_str2; + char fpath[PATH_MAX], *rev_str1, *rev_str2; const char *errstr; rev1 = rev2 = NULL; diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c index d5806e367f0..96ff687d17a 100644 --- a/usr.bin/rcs/rcsmerge.c +++ b/usr.bin/rcs/rcsmerge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsmerge.c,v 1.54 2014/10/10 08:15:25 otto Exp $ */ +/* $OpenBSD: rcsmerge.c,v 1.55 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> * All rights reserved. @@ -37,7 +37,7 @@ int rcsmerge_main(int argc, char **argv) { int fd, ch, flags, kflag, status; - char fpath[MAXPATHLEN], r1[RCS_REV_BUFSZ], r2[RCS_REV_BUFSZ]; + char fpath[PATH_MAX], r1[RCS_REV_BUFSZ], r2[RCS_REV_BUFSZ]; char *rev_str1, *rev_str2; RCSFILE *file; RCSNUM *rev1, *rev2; diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c index 907683453cb..71cc05d848a 100644 --- a/usr.bin/rcs/rcsnum.c +++ b/usr.bin/rcs/rcsnum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.15 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.16 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -24,15 +24,16 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <sys/param.h> - #include <ctype.h> #include <err.h> #include <string.h> +#include <limits.h> #include "rcs.h" #include "xmalloc.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + static void rcsnum_setsize(RCSNUM *, u_int); static char *rcsnum_itoa(u_int16_t, char *, size_t); @@ -199,7 +200,7 @@ rcsnum_cmp(const RCSNUM *n1, const RCSNUM *n2, u_int depth) u_int i; size_t slen; - slen = MIN(n1->rn_len, n2->rn_len); + slen = MINIMUM(n1->rn_len, n2->rn_len); if (depth != 0 && slen > depth) slen = depth; diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index c4b4729f8b3..0029cff4972 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.154 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.155 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -181,7 +181,7 @@ rcs_main(int argc, char **argv) int fd; int i, j, ch, flags, kflag, lkmode; const char *nflag, *oldfilename, *orange; - char fpath[MAXPATHLEN]; + char fpath[PATH_MAX]; char *logstr, *logmsg, *descfile; char *alist, *comment, *elist, *lrev, *urev; mode_t fmode; @@ -371,7 +371,7 @@ rcs_main(int argc, char **argv) if (rcsflags & CO_ACLAPPEND) { RCSFILE *oldfile; int ofd; - char ofpath[MAXPATHLEN]; + char ofpath[PATH_MAX]; ofd = rcs_choosefile(oldfilename, ofpath, sizeof(ofpath)); if (ofd < 0) { diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c index f27cf467e3e..258e5ed76af 100644 --- a/usr.bin/rcs/rcsutil.c +++ b/usr.bin/rcs/rcsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.42 2014/12/01 21:58:46 deraadt Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.43 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> @@ -154,8 +154,8 @@ rcs_choosefile(const char *filename, char *out, size_t len) { int fd; struct stat sb; - char *p, *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN], - *suffixes, rcspath[MAXPATHLEN]; + char *p, *ext, name[PATH_MAX], *next, *ptr, rcsdir[PATH_MAX], + *suffixes, rcspath[PATH_MAX]; /* * If `filename' contains a directory, `rcspath' contains that @@ -215,7 +215,7 @@ rcs_choosefile(const char *filename, char *out, size_t len) */ suffixes = xstrdup(rcs_suffixes); for (next = suffixes; (ext = strsep(&next, "/")) != NULL;) { - char fpath[MAXPATHLEN]; + char fpath[PATH_MAX]; if ((p = strrchr(rcspath, ',')) != NULL) { if (!strcmp(p, ext)) { diff --git a/usr.bin/rcs/rlog.c b/usr.bin/rcs/rlog.c index 9f4b8594767..bb9d1c2302f 100644 --- a/usr.bin/rcs/rlog.c +++ b/usr.bin/rcs/rlog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rlog.c,v 1.70 2014/11/28 15:09:50 otto Exp $ */ +/* $OpenBSD: rlog.c,v 1.71 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2005, 2009 Joris Vink <joris@openbsd.org> * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org> @@ -75,7 +75,7 @@ rlog_main(int argc, char **argv) RCSFILE *file; int Rflag; int i, ch, fd, status; - char fpath[MAXPATHLEN]; + char fpath[PATH_MAX]; rcsnum_flags |= RCSNUM_NO_MAGIC; hflag = Rflag = rflag = status = 0; diff --git a/usr.bin/rcs/worklist.h b/usr.bin/rcs/worklist.h index 40a9b125019..cf833e8580b 100644 --- a/usr.bin/rcs/worklist.h +++ b/usr.bin/rcs/worklist.h @@ -1,4 +1,4 @@ -/* $OpenBSD: worklist.h,v 1.3 2010/07/23 08:31:19 ray Exp $ */ +/* $OpenBSD: worklist.h,v 1.4 2015/01/16 06:40:11 deraadt Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -27,10 +27,11 @@ #ifndef WORKLIST_H #define WORKLIST_H -#include <sys/param.h> +#include <sys/types.h> +#include <limits.h> struct worklist { - char wkl_path[MAXPATHLEN]; + char wkl_path[PATH_MAX]; volatile SLIST_ENTRY(worklist) wkl_list; }; |