summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-12-21 11:42:39 +0200
committerTimo Teras <timo.teras@iki.fi>2009-12-21 11:42:39 +0200
commit366e7d07ae20d18cfc5f9f12588a0371654f956a (patch)
treeddec105784291affd88e96cde3c31b9c7bd41669 /src
parent507d34d64f817a2eb94b5d874cf985c1b96a9e30 (diff)
downloadapk-tools-366e7d07ae20d18cfc5f9f12588a0371654f956a.tar.bz2
apk-tools-366e7d07ae20d18cfc5f9f12588a0371654f956a.tar.xz
db: read time only once when writing scriptsdb
less syscalls.
Diffstat (limited to 'src')
-rw-r--r--src/database.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index f06eba4..2e3ed61 100644
--- a/src/database.c
+++ b/src/database.c
@@ -642,6 +642,7 @@ static int apk_db_scriptdb_write(struct apk_database *db, struct apk_ostream *os
char filename[256];
apk_blob_t bfn;
int r, i;
+ time_t now = time(NULL);
list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) {
pkg = ipkg->pkg;
@@ -654,6 +655,7 @@ static int apk_db_scriptdb_write(struct apk_database *db, struct apk_ostream *os
.name = filename,
.size = ipkg->script[i].len,
.mode = 0755 | S_IFREG,
+ .mtime = now,
};
/* The scripts db expects file names in format:
* pkg-version.<hexdump of package checksum>.action */
@@ -1892,7 +1894,7 @@ static void apk_db_migrate_files(struct apk_database *db,
} else {
/* check if want keep existing files */
if ((apk_flags & APK_NEVER_OVERWRITE) &&
- (faccessat(db->root_fd, name, F_OK,
+ (faccessat(db->root_fd, name, F_OK,
AT_SYMLINK_NOFOLLOW) == 0)) {
unlinkat(db->root_fd, tmpname, 0);
} else {