summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctm/mkCTM
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-11-16 22:05:46 +0000
committerphk <phk@FreeBSD.org>1996-11-16 22:05:46 +0000
commitf0c019885aa60e31c36721c1c903be9faf56ae86 (patch)
tree68c5a09860683535e8bd319cfe2df1c607f87c29 /usr.sbin/ctm/mkCTM
parent8f3378d1da3b956a14549eb4ed5f192b6c857307 (diff)
downloadFreeBSD-src-f0c019885aa60e31c36721c1c903be9faf56ae86.zip
FreeBSD-src-f0c019885aa60e31c36721c1c903be9faf56ae86.tar.gz
Check bogus and ignore against the relative name, not the absolute.
Diffstat (limited to 'usr.sbin/ctm/mkCTM')
-rw-r--r--usr.sbin/ctm/mkCTM/mkctm.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/usr.sbin/ctm/mkCTM/mkctm.c b/usr.sbin/ctm/mkCTM/mkctm.c
index 117542f..af96cdc 100644
--- a/usr.sbin/ctm/mkCTM/mkctm.c
+++ b/usr.sbin/ctm/mkCTM/mkctm.c
@@ -372,36 +372,38 @@ void
GetNext(int *i, int *n, struct dirent **nl, const char *dir, const char *name, u_long *ignored, u_long *bogus, u_long *wrong)
{
char buf[BUFSIZ];
+ char buf1[BUFSIZ];
for (;;) {
for (;;) {
(*i)++;
if (*i >= *n)
return;
- *buf = 0;
- if (*dir != '/')
- strcat(buf, "/");
- strcat(buf, dir);
- if (buf[strlen(buf)-1] != '/')
- strcat(buf, "/");
- strcat(buf, name);
- if (buf[strlen(buf)-1] != '/')
- strcat(buf, "/");
- strcat(buf, nl[*i]->d_name);
+ strcpy(buf1, name);
+ if (buf1[strlen(buf1)-1] != '/')
+ strcat(buf1, "/");
+ strcat(buf1, nl[*i]->d_name);
if (flag_ignore &&
- !regexec(&reg_ignore, buf, 0, 0, 0)) {
+ !regexec(&reg_ignore, buf1, 0, 0, 0)) {
(*ignored)++;
- fprintf(logf, "Ignore %s\n", buf);
+ fprintf(logf, "Ignore %s\n", buf1);
if (verbose > 2) {
- fprintf(stderr, "Ignore %s\n", buf);
+ fprintf(stderr, "Ignore %s\n", buf1);
}
} else if (flag_bogus &&
- !regexec(&reg_bogus, buf, 0, 0, 0)) {
+ !regexec(&reg_bogus, buf1, 0, 0, 0)) {
(*bogus)++;
- fprintf(logf, "Bogus %s\n", buf);
- fprintf(stderr, "Bogus %s\n", buf);
+ fprintf(logf, "Bogus %s\n", buf1);
+ fprintf(stderr, "Bogus %s\n", buf1);
damage++;
} else {
+ *buf = 0;
+ if (*dir != '/')
+ strcat(buf, "/");
+ strcat(buf, dir);
+ if (buf[strlen(buf)-1] != '/')
+ strcat(buf, "/");
+ strcat(buf, buf1);
break;
}
free(nl[*i]); nl[*i] = 0;
OpenPOWER on IntegriCloud