瀏覽代碼

dpkg: Change dir to / after chroot when using --instdir

Closes: #509578
Colin Watson 17 年之前
父節點
當前提交
4d74ed7589
共有 3 個文件被更改,包括 8 次插入0 次删除
  1. 4 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 2 0
      src/help.c

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+2008-12-30  Colin Watson  <cjwatson@ubuntu.com>
+
+	* src/help.c (preexecscript): Call chdir after chroot.
+
 2008-12-23  Guillem Jover  <guillem@debian.org>
 
 	* lib/log.c (statusfd_send): Pass to write the remaining data, not

+ 2 - 0
debian/changelog

@@ -39,6 +39,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
   * Use a the warning function to uniformly print all warning messages.
   * Properly use internerr to report about programming bugs.
   * Do not log repeated strings when the write call wrote partial data.
+  * Change dir to / after chroot when using --instdir.
+    Thanks to Colin Watson <cjwatson@ubuntu.com>. Closes: #509578
 
   [ Raphael Hertzog ]
   * Enhance dpkg-shlibdeps's error message when a library can't be found to

+ 2 - 0
src/help.c

@@ -155,6 +155,8 @@ static const char* preexecscript(const char *path, char *const *argv) {
 
   if (*instdir) {
     if (chroot(instdir)) ohshite(_("failed to chroot to `%.250s'"),instdir);
+    if (chdir("/"))
+      ohshite(_("failed to chdir to `%.255s'"), "/");
   }
   if (f_debug & dbg_scripts) {
     struct varbuf args = VARBUF_INIT;