summaryrefslogtreecommitdiff
path: root/apt-inst/dirstream.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-11-21 10:33:57 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-11-21 10:33:57 +0000
commitf2047f6b2aa62632b670343d4275be4d69f4b5e3 (patch)
treea7a5e09bf05eb0a1a25efdc7d14965a595f4a0ff /apt-inst/dirstream.cc
parent7e15443375875a15babd8bc35eeaef2785a06374 (diff)
* pkgDirStream has (slightly) better extract support now
Diffstat (limited to 'apt-inst/dirstream.cc')
-rw-r--r--apt-inst/dirstream.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-inst/dirstream.cc b/apt-inst/dirstream.cc
index 7ae93c9b0..898ede31b 100644
--- a/apt-inst/dirstream.cc
+++ b/apt-inst/dirstream.cc
@@ -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;
}