diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-09-15 22:12:24 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-09-15 22:12:24 +0000 |
commit | 412b8858d226637856e09d97b6535b7e85cb2a96 (patch) | |
tree | 77685173e0cea7917735ce4916b42474dfa430b4 /usr.bin | |
parent | 8638358dd1a684d2ee3499c8496bc5ecbb8314e4 (diff) |
strip trailing slashes from any arguments passed to opencvs.
ok xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/cvs.h | 10 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 7 | ||||
-rw-r--r-- | usr.bin/cvs/resp.c | 11 |
3 files changed, 15 insertions, 13 deletions
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index de8e058ed78..76e5f761d59 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.84 2005/09/15 17:01:10 xsa Exp $ */ +/* $OpenBSD: cvs.h,v 1.85 2005/09/15 22:12:23 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -250,7 +250,13 @@ struct cvsroot { #define CVS_ENTF_SYNC 0x01 /* contents of disk and memory match */ #define CVS_ENTF_WR 0x02 /* file is opened for writing too */ - +#define STRIP_SLASH(p) \ + do { \ + size_t _slen; \ + _slen = strlen(p); \ + while ((_slen > 0) && (p[_slen - 1] == '/')) \ + p[--_slen] = '\0'; \ + } while (0) struct cvs_ent { char *ce_buf; u_int16_t ce_type; diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index be13bde9774..510eb88ed76 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.122 2005/09/15 17:01:10 xsa Exp $ */ +/* $OpenBSD: file.c,v 1.123 2005/09/15 22:12:23 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -441,6 +441,11 @@ cvs_file_getspec(char **fspec, int fsn, int flags, int (*cb)(CVSFILE *, void *), strlcpy(pcopy, fspec[i], sizeof(pcopy)); /* + * get rid of any trailing slashes. + */ + STRIP_SLASH(pcopy); + + /* * Load the information. */ cf = cvs_file_loadinfo(pcopy, flags, cb, arg, freecf); diff --git a/usr.bin/cvs/resp.c b/usr.bin/cvs/resp.c index 37fc7af7a97..109f3020d89 100644 --- a/usr.bin/cvs/resp.c +++ b/usr.bin/cvs/resp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: resp.c,v 1.58 2005/09/15 17:01:10 xsa Exp $ */ +/* $OpenBSD: resp.c,v 1.59 2005/09/15 22:12:23 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -47,15 +47,6 @@ #define CVS_MTSTK_MAXDEPTH 16 -#define STRIP_SLASH(p) \ - do { \ - size_t _slen; \ - _slen = strlen(p); \ - while ((_slen > 0) && (p[_slen - 1] == '/')) \ - p[--_slen] = '\0'; \ - } while (0) - - static int cvs_resp_validreq (struct cvsroot *, int, char *); static int cvs_resp_cksum (struct cvsroot *, int, char *); static int cvs_resp_modtime (struct cvsroot *, int, char *); |