X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/36b8ebbb4a5db4909c3cf739d8ea472f70703662..1fa78a8a3730633be662df07f7aec8f4c3dcc766:/apt-pkg/contrib/cdromutl.cc

diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index 821e6d688..afa01a562 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -10,6 +10,8 @@
    ##################################################################### */
 									/*}}}*/
 // Include Files							/*{{{*/
+#include<config.h>
+
 #include <apt-pkg/cdromutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/md5.h>
@@ -17,8 +19,6 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/strutl.h>
 
-#include <apti18n.h>
-    
 #include <sys/wait.h>
 #include <sys/statvfs.h>
 #include <dirent.h>
@@ -26,8 +26,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdio.h>
+
+#include <apti18n.h>
 									/*}}}*/
 
+using std::string;
+
 // IsMounted - Returns true if the mount point is mounted		/*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple algorithm that should always work, we stat the mount point
@@ -118,8 +122,9 @@ bool MountCdrom(string Path, string DeviceName)
    if (Child == 0)
    {
       // Make all the fds /dev/null
+      int null_fd = open("/dev/null",O_RDWR);
       for (int I = 0; I != 3; I++)
-	 dup2(open("/dev/null",O_RDWR),I);
+	 dup2(null_fd, I);
       
       if (_config->Exists("Acquire::cdrom::"+Path+"::Mount") == true)
       {
@@ -258,7 +263,9 @@ string FindMountPointForDevice(const char *devnode)
                if(TokSplitString(' ', buf, out, 10))
                {
                   fclose(f);
-                  return string(out[1]);
+                  // unescape the \0XXX chars in the path
+                  string mount_point = out[1];
+                  return DeEscapeString(mount_point);
                }
             }
          }