From: root Date: Fri, 17 May 1996 18:47:11 +0000 (+0000) Subject: fix globbing bug when Root: is used X-Git-Tag: tznext/4.11.0.1.tizen20130304~11385 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df1a2b2fa4bf07975f7dd92d5d77b065502f4036;p=tools%2Flibrpm-tizen.git fix globbing bug when Root: is used CVS patchset: 575 CVS date: 1996/05/17 18:47:11 --- diff --git a/build/pack.c b/build/pack.c index 70296c6..a3023dd 100644 --- a/build/pack.c +++ b/build/pack.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "header.h" #include "specP.h" @@ -803,20 +804,27 @@ static int process_filelist(Header header, struct PackageRec *pr, } if (glob_pattern_p(filename)) { - if (glob(filename, 0, glob_error, &glob_result)) { - error(RPMERR_BADSPEC, - "No matches: %s", filename); + char fullname[1024]; + + if (getVar(RPMVAR_ROOT)) { + sprintf(fullname, "%s%s", getVar(RPMVAR_ROOT), filename); + } else { + strcpy(fullname, filename); + } + + if (glob(fullname, 0, glob_error, &glob_result)) { + error(RPMERR_BADSPEC, "No matches: %s", fullname); return(RPMERR_BADSPEC); } if (glob_result.gl_pathc < 1) { - error(RPMERR_BADSPEC, - "No matches: %s", filename); + error(RPMERR_BADSPEC, "No matches: %s", fullname); return(RPMERR_BADSPEC); } x = 0; c = 0; while (x < glob_result.gl_pathc) { - c += add_file(&fes, glob_result.gl_pathv[x], + int offset = strlen(getVar(RPMVAR_ROOT) ? : ""); + c += add_file(&fes, &(glob_result.gl_pathv[x][offset]), isdoc, isconf, isdir, verify_flags); x++; }