summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniklas <niklas@openbsd.org>1996-05-20 18:14:36 +0000
committerniklas <niklas@openbsd.org>1996-05-20 18:14:36 +0000
commit86ccfec49e5f36fc367c454af77ac9e1432975b3 (patch)
treea61be81b533ad6e2ca46990b43b4147989a52372
parentremove unused #defines. (diff)
downloadwireguard-openbsd-86ccfec49e5f36fc367c454af77ac9e1432975b3.tar.xz
wireguard-openbsd-86ccfec49e5f36fc367c454af77ac9e1432975b3.zip
Checking out in dirs having the repository as its prefix was sometimes
wrongly thought as checking out into the repository. E.g. checking out in /cvs.g/hack/foo with CVSROOT set to /cvs was impossible.
-rw-r--r--gnu/usr.bin/cvs/src/checkout.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gnu/usr.bin/cvs/src/checkout.c b/gnu/usr.bin/cvs/src/checkout.c
index 64aa10e247e..c5874645f0e 100644
--- a/gnu/usr.bin/cvs/src/checkout.c
+++ b/gnu/usr.bin/cvs/src/checkout.c
@@ -419,6 +419,7 @@ safe_location ()
{
char current[PATH_MAX];
char hardpath[PATH_MAX+5];
+ int hardpathlen;
int x;
x = readlink(CVSroot, hardpath, sizeof hardpath - 1);
@@ -431,7 +432,9 @@ safe_location ()
hardpath[x] = '\0';
}
getwd (current);
- if (strncmp(current, hardpath, strlen(hardpath)) == 0)
+ hardpathlen = strlen (hardpath);
+ if (strncmp(current, hardpath, hardpathlen) == 0
+ && (current[hardpathlen] == '\0' || current[hardpathlen] == '/'))
{
return (0);
}