Explorar o código

rework the code in cdromutl.cc to make coverity (more) happy

Michael Vogt %!s(int64=13) %!d(string=hai) anos
pai
achega
fe0036dd7e
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      apt-pkg/contrib/cdromutl.cc

+ 2 - 1
apt-pkg/contrib/cdromutl.cc

@@ -122,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)
       {