db: read time only once when writing scriptsdb

less syscalls.
cute-signatures
Timo Teras 2009-12-21 11:42:39 +02:00
parent 507d34d64f
commit 366e7d07ae
1 changed files with 3 additions and 1 deletions

View File

@ -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 */