--- rpm-4.5/rpmio/rpmrpc.c~ 2009-10-16 01:18:18.566743349 +0300 +++ rpm-4.5/rpmio/rpmrpc.c 2009-10-16 01:18:21.863999841 +0300 @@ -179,5 +179,6 @@ { const char * lpath; int ut = urlPath(path, &lpath); + int fdno; if (_rpmio_debug) @@ -212,7 +213,17 @@ if (mode == 0) mode = 0644; #endif - return open(path, flags, mode); + fdno = open(path, flags, mode); + /* XXX if the open(2) fails, try to strip a possible chroot(2) prefix. */ + if (fdno < 0 && errno == ENOENT) { + const char *dbpath = rpmExpand("%{_dbpath}", "/", NULL); + const char *fn = strstr(path + 1, dbpath); + if (fn) + fdno = open(fn, flags, mode); + if (dbpath) + dbpath = _free(dbpath); + } + return fdno; } /* XXX rpmdb.c: analogue to rename(2). */