diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-07-23 10:02:54 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-07-23 10:02:54 +0300 |
commit | bd21dff1087c4583c122197583952de715a38ff2 (patch) | |
tree | fcd59d5f71ea786e1b2b27335dca236f8b2cffc8 /build | |
parent | 00b4b3a68a6e88f11b958c54101d2aea735645e4 (diff) | |
download | rpm-bd21dff1087c4583c122197583952de715a38ff2.tar.gz rpm-bd21dff1087c4583c122197583952de715a38ff2.tar.bz2 rpm-bd21dff1087c4583c122197583952de715a38ff2.zip |
Avoid static buffer and extra copy in docdir checking.
From rpm5.org / Ralf S. Engelschall.
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/build/files.c b/build/files.c index aeaec15aa..d85b793ef 100644 --- a/build/files.c +++ b/build/files.c @@ -1072,13 +1072,12 @@ static int compareFileListRecs(const void * ap, const void * bp) /*@*/ static int isDoc(FileList fl, const char * fileName) /*@*/ { int x = fl->docDirCount; - char docdir[PATH_MAX], *d; + size_t k, l; + k = strlen(fileName); while (x--) { - d = stpcpy(docdir, fl->docDirs[x]); - if (*(d-1) != '/') - d = stpcpy(d, "/"); - if (strncmp(fileName, docdir, strlen(docdir)) == 0) + l = strlen(fl->docDirs[x]); + if (l < k && strncmp(fileName, fl->docDirs[x], l) == 0 && fileName[l] == '/') return 1; } return 0; |