diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-01-16 22:19:49 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-01-16 22:19:49 +0100 |
commit | 9ce3cfc9309c55cc01018c88c1ca82779fd74431 (patch) | |
tree | e113a963a732f497d0362d3fff9e5b3834d5a175 /ftparchive/multicompress.cc | |
parent | 62d8a765b9b37354efab6ca838cbdb7f347f7cac (diff) |
correct some style/performance/warnings from cppcheck
The most "visible" change is from utime to utimensat/futimens
as the first one isn't part of POSIX anymore.
Reported-By: cppcheck
Git-Dch: Ignore
Diffstat (limited to 'ftparchive/multicompress.cc')
-rw-r--r-- | ftparchive/multicompress.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ftparchive/multicompress.cc b/ftparchive/multicompress.cc index 1fea589e2..265fb1a80 100644 --- a/ftparchive/multicompress.cc +++ b/ftparchive/multicompress.cc @@ -21,9 +21,9 @@ #include <apt-pkg/error.h> #include <apt-pkg/md5.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> -#include <utime.h> #include <unistd.h> #include <iostream> @@ -234,14 +234,12 @@ bool MultiCompress::Finalize(unsigned long long &OutSize) else { // Update the mtime if necessary - if (UpdateMTime > 0 && + if (UpdateMTime > 0 && (Now - St.st_mtime > (signed)UpdateMTime || St.st_mtime > Now)) { - struct utimbuf Buf; - Buf.actime = Buf.modtime = Now; - utime(I->Output.c_str(),&Buf); + utimensat(AT_FDCWD, I->Output.c_str(), NULL, AT_SYMLINK_NOFOLLOW); Changed = true; - } + } } // Force the file permissions |