38 lines
1.1 KiB
Diff
38 lines
1.1 KiB
Diff
Obey --root option when calculating the directory of the
|
|
transaction lock.
|
|
|
|
Already fixed in rpm-4.4.7.
|
|
|
|
--- ./lib/rpmlock.c.orig 2005-12-21 14:34:27.000000000 +0000
|
|
+++ ./lib/rpmlock.c 2005-12-21 14:42:59.000000000 +0000
|
|
@@ -45,12 +45,18 @@ static rpmlock rpmlock_new(/*@unused@*/
|
|
}
|
|
if (lock != NULL) {
|
|
mode_t oldmask = umask(022);
|
|
- lock->fd = open(rpmlock_path, O_RDWR|O_CREAT, 0644);
|
|
+ char *path = rpmlock_path;
|
|
+ if (rootdir && *rootdir == '/' && rootdir[1] != 0) {
|
|
+ path = xmalloc(strlen(rootdir) + strlen(rpmlock_path) + 1);
|
|
+ strcpy(path, rootdir);
|
|
+ strcat(path, rpmlock_path);
|
|
+ }
|
|
+ lock->fd = open(path, O_RDWR|O_CREAT, 0644);
|
|
(void) umask(oldmask);
|
|
|
|
/*@-branchstate@*/
|
|
if (lock->fd == -1) {
|
|
- lock->fd = open(rpmlock_path, O_RDONLY);
|
|
+ lock->fd = open(path, O_RDONLY);
|
|
if (lock->fd == -1) {
|
|
free(lock);
|
|
lock = NULL;
|
|
@@ -64,6 +70,8 @@ static rpmlock rpmlock_new(/*@unused@*/
|
|
lock->openmode = RPMLOCK_WRITE | RPMLOCK_READ;
|
|
/*@=nullderef@*/
|
|
}
|
|
+ if (path != rpmlock_path)
|
|
+ free(path);
|
|
/*@=branchstate@*/
|
|
}
|
|
/*@-compdef@*/
|