Oops, simplified it a little bit much, fixing

This commit is contained in:
Jindrich Novy 2008-04-28 14:08:35 +02:00
parent 98259f8edb
commit 18bf8b8b8e
1 changed files with 4 additions and 3 deletions

View File

@ -1063,7 +1063,7 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec,
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
const char * dirName;
char * dirName;
const char * baseName;
rpmTagType bnt, dnt;
fingerPrintCache fpc;
@ -1080,11 +1080,12 @@ static int rpmdbFindByFile(rpmdb db, const char * filespec,
if (filespec == NULL) return -2;
if ((baseName = strrchr(filespec, '/')) != NULL) {
dirName = strncpy(xmalloc(len + 1), filespec, baseName - filespec + 1);
size_t len = baseName - filespec + 1;
dirName = strncpy(xmalloc(len + 1), filespec, len);
dirName[len] = '\0';
baseName++;
} else {
dirName = "";
dirName = xstrdup("");
baseName = filespec;
}
if (baseName == NULL)