summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:52:26 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:52:26 +0000
commit7f25bdff3a0fa55ba897964d5c82475b45f3325a (patch)
tree7190f1448161be6bfd163cdd88efee6101e1ae8c /apt-pkg/contrib/fileutl.cc
parenta9975068c7d55b2fbe46aacf94a36b460fd1d9da (diff)
Dsync merge
Author: jgg Date: 1999-01-18 06:20:07 GMT Dsync merge
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 379641c2c..b65757925 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.16 1998/11/27 04:20:52 jgg Exp $
+// $Id: fileutl.cc,v 1.17 1999/01/18 06:20:08 jgg Exp $
/* ######################################################################
File Utilities
@@ -102,8 +102,11 @@ string SafeGetCWD()
// Stash the current dir.
char S[300];
S[0] = 0;
- if (getcwd(S,sizeof(S)) == 0)
+ if (getcwd(S,sizeof(S)-2) == 0)
return "/";
+ unsigned int Len = strlen(S);
+ S[Len] = '/';
+ S[Len+1] = 0;
return S;
}
/*}}}*/
@@ -263,6 +266,17 @@ bool FileFd::Seek(unsigned long To)
return true;
}
/*}}}*/
+// FileFd::Tell - Current seek position /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned long FileFd::Tell()
+{
+ off_t Res = lseek(iFd,0,SEEK_CUR);
+ if (Res == (off_t)-1)
+ _error->Errno("lseek","Failed to determine the current file position");
+ return Res;
+}
+ /*}}}*/
// FileFd::Size - Return the size of the file /*{{{*/
// ---------------------------------------------------------------------
/* */