]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-lua-exit-chroot-correctly.patch
- for .la symlinks generate libtool(symlink), not libtool(target) Provides
[packages/rpm.git] / rpm-lua-exit-chroot-correctly.patch
CommitLineData
9ec7dc5f 1--- rpm-5.2.0/lib/psm.c 2009-07-07 23:12:33.000000000 +0200
2+++ rpm-5.2.0/lib/psm.c 2010-05-08 15:17:24.063904813 +0200
3@@ -576,17 +576,21 @@
4 #endif /* WITH_LUA */
5
6 #if defined(WITH_LUA) || defined(WITH_FICL) || defined(WITH_JS) || defined(WITH_PERLEMBED) || defined(WITH_PYTHONEMBED) || defined(WITH_RUBYEMBED) || defined(WITH_TCL)
7-static int enterChroot(rpmpsm psm, int * fdnop)
8+static int enterChroot(rpmpsm psm, int * pwdFdnop, int * rootFdnop)
9 /*@globals fileSystem, internalState @*/
10- /*@modifies *fdnop, fileSystem, internalState @*/
11+ /*@modifies *pwdFdnop, *rootFdnop, fileSystem, internalState @*/
7009e3a8 12 {
13 const rpmts ts = psm->ts;
9ec7dc5f 14 int inChroot;
15 int xx;
7009e3a8 16
17 /* Save the current working directory. */
9ec7dc5f 18- if (fdnop)
19- (*fdnop) = open(".", O_RDONLY, 0);
20+ if (pwdFdnop)
21+ (*pwdFdnop) = open(".", O_RDONLY, 0);
7009e3a8 22+
9ec7dc5f 23+ /* Save the current root directory. */
24+ if (rootFdnop)
25+ (*rootFdnop) = open("/", O_RDONLY, 0);
26
7009e3a8 27 /* Get into the chroot. */
28 if (!rpmtsChrootDone(ts)) {
9ec7dc5f 29@@ -607,7 +611,7 @@
30 return inChroot;
31 }
32
33-static int exitChroot(rpmpsm psm, int inChroot, int rootFdno)
34+static int exitChroot(rpmpsm psm, int inChroot, int pwdFdno, int rootFdno)
35 /*@globals fileSystem, internalState @*/
36 /*@modifies fileSystem, internalState @*/
37 {
38@@ -623,10 +627,12 @@
39 /*@=modobserver@*/
7009e3a8 40 xx = rpmtsSetChrootDone(ts, 0);
41 }
42+ xx = fchdir(pwdFdno);
43 } else
44- xx = fchdir(rootFdno);
45+ xx = fchdir(pwdFdno);
46
47 xx = close(rootFdno);
48+ xx = close(pwdFdno);
49
9ec7dc5f 50 return 0;
51 }
52@@ -648,11 +654,12 @@
53 /*@modifies psm, fileSystem, internalState @*/
54 {
55 char * av[] = { NULL, NULL, NULL, NULL };
56+ int pwdFdno = -1;
57 int rootFdno = -1;
58 rpmRC rc = RPMRC_OK;
59 int xx = 0;
60 int * ssp = NULL;
61- int inChroot = enterChroot(psm, &rootFdno);
62+ int inChroot = enterChroot(psm, &pwdFdno, &rootFdno);
63
64 if (psm->sstates != NULL)
65 ssp = psm->sstates + tag2slx(psm->scriptTag);
66@@ -726,7 +733,7 @@
67 *ssp |= RPMSCRIPT_STATE_REAPED;
68 }
69
70- xx = exitChroot(psm, inChroot, rootFdno);
71+ xx = exitChroot(psm, inChroot, pwdFdno, rootFdno);
72
7009e3a8 73 return rc;
74 }
This page took 0.031731 seconds and 4 git commands to generate.