projects
/
platform
/
upstream
/
rpm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b4fb887
)
Avoid static buffer and extra copy in docdir checking.
author
Panu Matilainen
<pmatilai@redhat.com>
Mon, 23 Jul 2007 07:02:54 +0000
(10:02 +0300)
committer
Panu Matilainen
<pmatilai@redhat.com>
Mon, 23 Jul 2007 07:02:54 +0000
(10:02 +0300)
From rpm5.org / Ralf S. Engelschall.
(transplanted from
414d128db0aaea7abbd2040e041c2290802eee53
)
build/files.c
patch
|
blob
|
history
diff --git
a/build/files.c
b/build/files.c
index
110bce1
..
1400250
100644
(file)
--- 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;