]>
Commit | Line | Data |
---|---|---|
c3a6b2ca ER |
1 | --- rpm-4.5/rpmio/rpmrpc.c~ 2009-10-16 01:18:18.566743349 +0300 |
2 | +++ rpm-4.5/rpmio/rpmrpc.c 2009-10-16 01:18:21.863999841 +0300 | |
3 | @@ -179,5 +179,6 @@ | |
4 | { | |
5 | const char * lpath; | |
6 | int ut = urlPath(path, &lpath); | |
7 | + int fdno; | |
b705e4bd | 8 | |
c3a6b2ca ER |
9 | if (_rpmio_debug) |
10 | @@ -212,7 +213,17 @@ | |
11 | if (mode == 0) | |
12 | mode = 0644; | |
13 | #endif | |
14 | - return open(path, flags, mode); | |
15 | + fdno = open(path, flags, mode); | |
16 | + /* XXX if the open(2) fails, try to strip a possible chroot(2) prefix. */ | |
17 | + if (fdno < 0 && errno == ENOENT) { | |
18 | + const char *dbpath = rpmExpand("%{_dbpath}", "/", NULL); | |
19 | + const char *fn = strstr(path + 1, dbpath); | |
20 | + if (fn) | |
21 | + fdno = open(fn, flags, mode); | |
22 | + if (dbpath) | |
23 | + dbpath = _free(dbpath); | |
24 | + } | |
25 | + return fdno; | |
26 | } | |
27 | ||
28 | /* XXX rpmdb.c: analogue to rename(2). */ |