[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rpmorg-maint
Subject:    [Rpm-maint] [Suse patch] Make transaction lock relative to --root
From:       pmatilai () redhat ! com (Panu Matilainen)
Date:       2007-05-23 9:04:58
Message-ID: Pine.LNX.4.64.0705231202381.17716 () dhcp115 ! koti ! laiskiainen ! org
[Download RAW message or body]


As far as I can tell, this has already been fixed in rpm.org tree, albeit 
somewhat differently: http://hg.rpm.org/rpm?cs=0a840aa65e58

 	- Panu -

---

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@*/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic