fix globbing bug when Root: is used
authorroot <devnull@localhost>
Fri, 17 May 1996 18:47:11 +0000 (18:47 +0000)
committerroot <devnull@localhost>
Fri, 17 May 1996 18:47:11 +0000 (18:47 +0000)
CVS patchset: 575
CVS date: 1996/05/17 18:47:11

build/pack.c

index 70296c6..a3023dd 100644 (file)
@@ -20,6 +20,7 @@
 #include <netdb.h>
 #include <glob.h>
 #include <zlib.h>
+#include <errno.h>
 
 #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++;
                }