From d9d95d9dab004609b86f39d2da101ca58e595471 Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Thu, 24 Oct 2013 20:55:26 +0200 Subject: Fixes a case of sizeof(struct stat) disagreeing between libwibble and libept on some architectures. --- ept/apt/apt.cc | 10 ++-------- ept/axi/axi.cc | 6 +----- ept/debtags/debtags.cc | 5 ++--- ept/debtags/maint/path.cc | 8 +++----- ept/debtags/maint/path.h | 2 -- ept/debtags/vocabulary.cc | 1 - ept/popcon/maint/path.cc | 8 +++----- ept/popcon/maint/path.h | 2 -- 8 files changed, 11 insertions(+), 31 deletions(-) (limited to 'ept') diff --git a/ept/apt/apt.cc b/ept/apt/apt.cc index 2d625fb..f3552f9 100644 --- a/ept/apt/apt.cc +++ b/ept/apt/apt.cc @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -47,13 +46,8 @@ static time_t aptTimestamp() { namespace wfs = wibble::sys::fs; - std::auto_ptr st = wfs::stat( - _config->FindFile( "Dir::Cache::pkgcache" ) ); - time_t t1 = st.get() == NULL ? 0 : st->st_mtime; - - std::auto_ptr st1 = wfs::stat( - _config->FindFile( "Dir::State::status" ) ); - time_t t2 = st1.get() == NULL ? 0 : st1->st_mtime; + time_t t1 = wfs::timestamp(_config->FindFile("Dir::Cache::pkgcache"), 0); + time_t t2 = wfs::timestamp(_config->FindFile("Dir::State::status"), 0); return t1 > t2 ? t1 : t2; } diff --git a/ept/axi/axi.cc b/ept/axi/axi.cc index a9b3203..020d079 100644 --- a/ept/axi/axi.cc +++ b/ept/axi/axi.cc @@ -51,11 +51,7 @@ std::string path_db() time_t timestamp() { string tsfile = str::joinpath(m_index_dir, "update-timestamp"); - std::auto_ptr st = sys::fs::stat(tsfile); - if (st.get()) - return st->st_mtime; - else - return 0; + return sys::fs::timestamp(tsfile, 0); } diff --git a/ept/debtags/debtags.cc b/ept/debtags/debtags.cc index 068330f..a889ae3 100644 --- a/ept/debtags/debtags.cc +++ b/ept/debtags/debtags.cc @@ -39,10 +39,9 @@ #include #include // WIFEXITED WEXITSTATUS -#include // getpwuid, stat, mkdir, getuid -#include // stat, mkdir +#include // getpwuid, getuid #include // getpwuid -#include // stat, getuid +#include // getuid using namespace std; diff --git a/ept/debtags/maint/path.cc b/ept/debtags/maint/path.cc index 8fdae9a..bb08682 100644 --- a/ept/debtags/maint/path.cc +++ b/ept/debtags/maint/path.cc @@ -28,10 +28,9 @@ #include #include -#include // getpwuid, stat, mkdir, getuid -#include // stat, mkdir +#include // getpwuid, getuid #include // getpwuid -#include // stat, getuid +#include // getuid using namespace wibble; @@ -65,8 +64,7 @@ int Path::access( const std::string &s, int m ) { } time_t Path::timestamp( const std::string& file ) { - std::auto_ptr st = wibble::sys::fs::stat(file); - return st.get() == NULL ? 0 : st->st_mtime; + return sys::fs::timestamp(file, 0); } void Path::setDebtagsSourceDir( const std::string &s ) diff --git a/ept/debtags/maint/path.h b/ept/debtags/maint/path.h index 0127829..2c7f95e 100644 --- a/ept/debtags/maint/path.h +++ b/ept/debtags/maint/path.h @@ -23,8 +23,6 @@ #include -struct stat; - #ifndef EPT_DEBTAGS_PATH_H #define EPT_DEBTAGS_PATH_H diff --git a/ept/debtags/vocabulary.cc b/ept/debtags/vocabulary.cc index 1f85d12..5c84ea4 100644 --- a/ept/debtags/vocabulary.cc +++ b/ept/debtags/vocabulary.cc @@ -30,7 +30,6 @@ #include #include -#include #include using namespace std; diff --git a/ept/popcon/maint/path.cc b/ept/popcon/maint/path.cc index acb5029..aef6314 100644 --- a/ept/popcon/maint/path.cc +++ b/ept/popcon/maint/path.cc @@ -28,10 +28,9 @@ #include #include -#include // getpwuid, stat, mkdir, getuid -#include // stat, mkdir +#include // getpwuid, getuid #include // getpwuid -#include // stat, getuid +#include // getuid using namespace wibble; @@ -65,8 +64,7 @@ int Path::access( const std::string &s, int m ) { } time_t Path::timestamp( const std::string& file ) { - std::auto_ptr st = wibble::sys::fs::stat(file); - return st.get() == NULL ? 0 : st->st_mtime; + return sys::fs::timestamp(file, 0); } void Path::setPopconSourceDir( const std::string &s ) diff --git a/ept/popcon/maint/path.h b/ept/popcon/maint/path.h index 5b4306c..cb4c31d 100644 --- a/ept/popcon/maint/path.h +++ b/ept/popcon/maint/path.h @@ -26,8 +26,6 @@ #include -struct stat; - namespace ept { namespace popcon { -- cgit v1.2.3