summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:57 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:57 +0000
commit34fc04214f843dd8f01398014961217cb9684c87 (patch)
treec466c676364a79aec58544e70403d559f81a1d67 /apt-pkg
parentf78439bfef02317c4d9d8138af7bdfb3b73fcec2 (diff)
Changed CD ident rountine to not use inodes
Author: jgg Date: 1999-06-05 03:54:29 GMT Changed CD ident rountine to not use inodes
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/cdromutl.cc22
-rw-r--r--apt-pkg/contrib/cdromutl.h4
2 files changed, 19 insertions, 7 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc
index d0d810c5d..99eb540ec 100644
--- a/apt-pkg/contrib/cdromutl.cc
+++ b/apt-pkg/contrib/cdromutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cdromutl.cc,v 1.5 1999/04/20 05:11:17 jgg Exp $
+// $Id: cdromutl.cc,v 1.6 1999/06/05 03:54:29 jgg Exp $
/* ######################################################################
CDROM Utilities - Some functions to manipulate CDROM mounts.
@@ -160,7 +160,7 @@ bool MountCdrom(string Path)
// ---------------------------------------------------------------------
/* We convert everything we hash into a string, this prevents byte size/order
from effecting the outcome. */
-bool IdentCdrom(string CD,string &Res)
+bool IdentCdrom(string CD,string &Res,unsigned int Version)
{
MD5Summation Hash;
@@ -182,8 +182,19 @@ bool IdentCdrom(string CD,string &Res)
if (strcmp(Dir->d_name,".") == 0 ||
strcmp(Dir->d_name,"..") == 0)
continue;
-
- sprintf(S,"%lu",Dir->d_ino);
+
+ if (Version <= 1)
+ {
+ sprintf(S,"%lu",Dir->d_ino);
+ }
+ else
+ {
+ struct stat Buf;
+ if (stat(Dir->d_name,&Buf) != 0)
+ continue;
+ sprintf(S,"%lu",Buf.st_mtime);
+ }
+
Hash.Add(S);
Hash.Add(Dir->d_name);
};
@@ -201,7 +212,8 @@ bool IdentCdrom(string CD,string &Res)
(long)(Buf.f_bfree*(Buf.f_bsize/1024)));
Hash.Add(S);
- Res = Hash.Result().Value();
+ sprintf(S,"-%u",Version);
+ Res = Hash.Result().Value() + S;
return true;
}
/*}}}*/
diff --git a/apt-pkg/contrib/cdromutl.h b/apt-pkg/contrib/cdromutl.h
index a9f4f926c..309857dde 100644
--- a/apt-pkg/contrib/cdromutl.h
+++ b/apt-pkg/contrib/cdromutl.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cdromutl.h,v 1.1 1998/11/29 01:19:27 jgg Exp $
+// $Id: cdromutl.h,v 1.2 1999/06/05 03:54:29 jgg Exp $
/* ######################################################################
CDROM Utilities - Some functions to manipulate CDROM mounts.
@@ -18,6 +18,6 @@
bool MountCdrom(string Path);
bool UnmountCdrom(string Path);
-bool IdentCdrom(string CD,string &Res);
+bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
#endif