diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-03-15 02:46:15 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-03-15 02:46:15 +0000 |
commit | 3bed677bcd677666e07a6745739c527d17b91861 (patch) | |
tree | 521706d80cabfd7cad284afcbffc7f622ff03352 | |
parent | 05d04d8298362f665859c70fa3dbe2cc7f2a8b06 (diff) |
Don't assume there is an RCS directory just because the filename
contains the letters `RCS'.
ok niallo
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index bea11281c5e..7cad13ce45d 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.72 2006/03/14 03:33:30 ray Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.73 2006/03/15 02:46:14 ray Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -230,17 +230,13 @@ rcs_getopt(int argc, char **argv, const char *optstr) int rcs_statfile(char *fname, char *out, size_t len) { - int found, strdir; + int found; char defaultsuffix[] = RCS_DEFAULT_SUFFIX; char filev[MAXPATHLEN], fpath[MAXPATHLEN]; char *ext, *slash; struct stat st; - strdir = found = 0; - - /* we might have gotten the RCS/ dir in the argument string */ - if (strstr(fname, RCSDIR) != NULL) - strdir = 1; + found = 0; if (rcs_suffixes != NULL) ext = rcs_suffixes; @@ -266,8 +262,7 @@ rcs_statfile(char *fname, char *out, size_t len) strlcat(filev, ext, sizeof(filev)) >= sizeof(filev)) fatal("rcs_statfile: path truncation"); - if ((strdir == 0) && - (stat(RCSDIR, &st) != -1) && (st.st_mode & S_IFDIR)) { + if (stat(RCSDIR, &st) != -1 && (st.st_mode & S_IFDIR)) { if (strlcpy(fpath, RCSDIR, sizeof(fpath)) >= sizeof(fpath) || strlcat(fpath, "/", |