summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:37 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:37 +0000
commitd38b7b3d803a719b189df80820aeda6a818f4909 (patch)
tree28143d1b948d8b31fc8bec91b50d2fdfe6ff3341 /apt-pkg/contrib
parentc217f42adc1a82c7400e85178f61bf429fea1bc4 (diff)
Needs Unpack fixes
Author: jgg Date: 1998-11-23 07:02:58 GMT Needs Unpack fixes
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc21
-rw-r--r--apt-pkg/contrib/fileutl.h5
-rw-r--r--apt-pkg/contrib/mmap.cc5
3 files changed, 21 insertions, 10 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 77e846117..3ca36377a 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.13 1998/10/26 07:11:49 jgg Exp $
+// $Id: fileutl.cc,v 1.14 1998/11/23 07:03:06 jgg Exp $
/* ######################################################################
File Utilities
@@ -119,6 +119,18 @@ string flNotDir(string File)
return string(File,Res,Res - File.length());
}
/*}}}*/
+// flNotFile - Strip the file from the directory name /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string flNotFile(string File)
+{
+ string::size_type Res = File.rfind('/');
+ if (Res == string::npos)
+ return File;
+ Res++;
+ return string(File,0,Res);
+}
+ /*}}}*/
// SetCloseExec - Set the close on exec flag /*{{{*/
// ---------------------------------------------------------------------
/* */
@@ -184,12 +196,7 @@ FileFd::FileFd(string FileName,OpenMode Mode, unsigned long Perms)
case WriteAny:
iFd = open(FileName.c_str(),O_RDWR | O_CREAT,Perms);
- break;
-
- // Dont use this in public directories
- case LockEmpty:
- iFd = open(FileName.c_str(),O_RDWR | O_CREAT | O_TRUNC,Perms);
- break;
+ break;
}
if (iFd < 0)
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 01dc46b13..31af3d28b 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.h,v 1.8 1998/10/26 07:11:50 jgg Exp $
+// $Id: fileutl.h,v 1.9 1998/11/23 07:03:07 jgg Exp $
/* ######################################################################
File Utilities
@@ -38,7 +38,7 @@ class FileFd
string FileName;
public:
- enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny,LockEmpty};
+ enum OpenMode {ReadOnly,WriteEmpty,WriteExists,WriteAny};
bool Read(void *To,unsigned long Size);
bool Write(void *From,unsigned long Size);
@@ -69,5 +69,6 @@ bool WaitFd(int Fd);
// File string manipulators
string flNotDir(string File);
+string flNotFile(string File);
#endif
diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc
index f6def2154..0ac202aef 100644
--- a/apt-pkg/contrib/mmap.cc
+++ b/apt-pkg/contrib/mmap.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: mmap.cc,v 1.9 1998/11/12 03:14:39 jgg Exp $
+// $Id: mmap.cc,v 1.10 1998/11/23 07:03:08 jgg Exp $
/* ######################################################################
MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -130,6 +130,9 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace) :
MMap(F,Flags | NoImmMap), WorkSpace(WorkSpace)
{
+ if (_error->PendingError() == true)
+ return;
+
unsigned long EndOfFile = Fd.Size();
Fd.Seek(WorkSpace);
char C = 0;