瀏覽代碼

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

Michael Vogt 13 年之前
父節點
當前提交
fe0036dd7e
共有 1 個文件被更改,包括 2 次插入1 次删除
  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)
    if (Child == 0)
    {
    {
       // Make all the fds /dev/null
       // Make all the fds /dev/null
+      int null_fd = open("/dev/null",O_RDWR);
       for (int I = 0; I != 3; I++)
       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)
       if (_config->Exists("Acquire::cdrom::"+Path+"::Mount") == true)
       {
       {