diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:08 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:54:08 +0000 |
commit | fbdccabb17963090e21e3b02bc72dda68f34d524 (patch) | |
tree | 9ae709612975d84c90ff3710f01d95115ae5e173 /apt-pkg/contrib/cdromutl.cc | |
parent | 5d9649ffe56ddb777350ecdf71b1f2b05ee28878 (diff) | |
download | apt-fbdccabb17963090e21e3b02bc72dda68f34d524.tar.gz |
CDROM debug option
Author: jgg
Date: 1999-07-02 22:20:50 GMT
CDROM debug option
Diffstat (limited to 'apt-pkg/contrib/cdromutl.cc')
-rw-r--r-- | apt-pkg/contrib/cdromutl.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/apt-pkg/contrib/cdromutl.cc b/apt-pkg/contrib/cdromutl.cc index 99eb540e..7f79e878 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.6 1999/06/05 03:54:29 jgg Exp $ +// $Id: cdromutl.cc,v 1.7 1999/07/02 22:21:01 jgg Exp $ /* ###################################################################### CDROM Utilities - Some functions to manipulate CDROM mounts. @@ -203,16 +203,21 @@ bool IdentCdrom(string CD,string &Res,unsigned int Version) closedir(D); // Some stats from the fsys - struct statfs Buf; - if (statfs(CD.c_str(),&Buf) != 0) - return _error->Errno("statfs","Failed to stat the cdrom"); - - // We use a kilobyte block size to advoid overflow - sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)), - (long)(Buf.f_bfree*(Buf.f_bsize/1024))); - Hash.Add(S); + if (_config->FindB("Debug::identcdrom",false) == false) + { + struct statfs Buf; + if (statfs(CD.c_str(),&Buf) != 0) + return _error->Errno("statfs","Failed to stat the cdrom"); + + // We use a kilobyte block size to advoid overflow + sprintf(S,"%lu %lu",(long)(Buf.f_blocks*(Buf.f_bsize/1024)), + (long)(Buf.f_bfree*(Buf.f_bsize/1024))); + Hash.Add(S); + sprintf(S,"-%u",Version); + } + else + sprintf(S,"-%u.debug",Version); - sprintf(S,"-%u",Version); Res = Hash.Result().Value() + S; return true; } |