Make rebuilddb work with the --root option.
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 16 May 2007 13:18:05 +0000 (16:18 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 16 May 2007 13:18:05 +0000 (16:18 +0300)
Patch from OpenSuSE.

rpmdb/rpmdb.c

index c15253e..e88c92e 100644 (file)
@@ -3773,7 +3773,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
     }
     dbpath = rootdbpath = rpmGetPath(prefix, tfn, NULL);
     if (!(prefix[0] == '/' && prefix[1] == '\0'))
-       dbpath += strlen(prefix);
+       dbpath += strlen(prefix) - 1;
     tfn = _free(tfn);
 
     /*@-nullpass@*/
@@ -3796,7 +3796,7 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
     }
     newdbpath = newrootdbpath = rpmGetPath(prefix, tfn, NULL);
     if (!(prefix[0] == '/' && prefix[1] == '\0'))
-       newdbpath += strlen(prefix);
+       newdbpath += strlen(prefix) - 1;
     tfn = _free(tfn);
 
     rpmMessage(RPMMESS_DEBUG, _("rebuilding database %s into %s\n"),