Paul Nasrat f8e442
--- rpm-4.4.2/lib/rpmlock.c.userlock	2005-01-26 13:41:43.000000000 +0000
Paul Nasrat f8e442
+++ rpm-4.4.2/lib/rpmlock.c	2007-03-13 10:33:15.000000000 +0000
Paul Nasrat f8e442
@@ -37,9 +37,9 @@
Paul Nasrat 57dc36
 
Paul Nasrat 57dc36
 	/* XXX oneshot to determine path for fcntl lock. */
Paul Nasrat 57dc36
 	if (rpmlock_path == NULL) {
Paul Nasrat 57dc36
-	    char * t = rpmExpand(rpmlock_path_default, NULL);
Paul Nasrat 57dc36
+	    char * t = rpmGenPath(rootdir, rpmlock_path_default, NULL);
Paul Nasrat 57dc36
 	    if (t == NULL || *t == '\0' || *t == '%')
Paul Nasrat f8e442
-		t = RPMLOCK_PATH;
Paul Nasrat f8e442
+		t = strdup(RPMLOCK_PATH);
Paul Nasrat 57dc36
 	    rpmlock_path = xstrdup(t);
Paul Nasrat f8e442
 	    t = _free(t);
Paul Nasrat f8e442
 	}
Paul Nasrat 57dc36
@@ -129,7 +129,7 @@
Paul Nasrat 57dc36
 	const char *rootDir = rpmtsRootDir(ts);
Paul Nasrat 57dc36
 	rpmlock lock;
Paul Nasrat 57dc36
 
Paul Nasrat 57dc36
-	if (!rootDir)
Paul Nasrat 57dc36
+	if (!rootDir || rpmtsChrootDone(ts))
Paul Nasrat 57dc36
 		rootDir = "/";
Paul Nasrat 57dc36
 	lock = rpmlock_new(rootDir);
Paul Nasrat 57dc36
 /*@-branchstate@*/