]> git.saurik.com Git - apt.git/blobdiff - apt-inst/dirstream.cc
Updated Russian translation. Closes: #405476
[apt.git] / apt-inst / dirstream.cc
index 7ae93c9b0c11b3779802d0e66efbbf03ae448348..898ede31b3c8dfe926e08325f32ddf5c6f6e2514 100644 (file)
@@ -61,6 +61,22 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd)
       case Item::CharDevice:
       case Item::BlockDevice:
       case Item::Directory:
+      {
+        struct stat Buf;
+        // check if the dir is already there, if so return true
+        if (stat(Itm.Name,&Buf) == 0)
+        {
+           if(S_ISDIR(Buf.st_mode))
+              return true;
+           // something else is there already, return false
+           return false;
+        }
+        // nothing here, create the dir
+        if(mkdir(Itm.Name,Itm.Mode) < 0)
+           return false;
+        return true;
+        break;
+      }
       case Item::FIFO:
       break;
    }