diff -ur rpm-4.4.1/lib/rpmlock.c rpm-4.4.1-lock-in-root/lib/rpmlock.c --- rpm-4.4.1/lib/rpmlock.c 2005-01-26 16:41:43.000000000 +0300 +++ rpm-4.4.1-lock-in-root/lib/rpmlock.c 2005-09-28 13:58:39.000000000 +0400 @@ -29,7 +29,7 @@ } * rpmlock; /*@null@*/ -static rpmlock rpmlock_new(/*@unused@*/ const char *rootdir) +static rpmlock rpmlock_new(const char *rootdir) /*@globals fileSystem @*/ /*@modifies fileSystem @*/ { @@ -40,7 +40,15 @@ char * t = rpmExpand(rpmlock_path_default, NULL); if (t == NULL || *t == '\0' || *t == '%') t = RPMLOCK_PATH; - rpmlock_path = xstrdup(t); + if ( (rootdir == NULL) || (*rootdir == '\0') || + ((rootdir[0] == '/') && (rootdir[1] == '\0')) ) { + rpmlock_path = xstrdup(t); + } + else { + rpmlock_path = (char *)malloc(strlen(rootdir) + strlen(t) + 1); + strcpy(rpmlock_path, rootdir); + strcat(rpmlock_path, t); + } t = _free(t); } if (lock != NULL) {