diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2017-06-26 00:51:38 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-10-06 16:18:12 +0300 |
commit | 34a97bbe80fc7f511813f816c5a3a6b09fb54fcc (patch) | |
tree | 41919867b0a88f8bf4f90a517c1c315b255dfcb9 | |
parent | 9852819ffd71fe7d2df3665c339bbe9b2371f272 (diff) | |
download | apk-tools-34a97bbe80fc7f511813f816c5a3a6b09fb54fcc.tar.gz apk-tools-34a97bbe80fc7f511813f816c5a3a6b09fb54fcc.tar.bz2 apk-tools-34a97bbe80fc7f511813f816c5a3a6b09fb54fcc.tar.xz apk-tools-34a97bbe80fc7f511813f816c5a3a6b09fb54fcc.zip |
database: mark error on renameat failure
(cherry picked from commit 17dd532e428e647e9d977e727c87c0f3a4e93ae3)
-rw-r--r-- | src/database.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 4d16900..7c3c646 100644 --- a/src/database.c +++ b/src/database.c @@ -2652,8 +2652,12 @@ static void apk_db_migrate_files(struct apk_database *db, unlinkat(db->root_fd, tmpname, 0); } else { /* Overwrite the old file */ - renameat(db->root_fd, tmpname, - db->root_fd, name); + if (renameat(db->root_fd, tmpname, + db->root_fd, name) != 0) { + apk_error(PKG_VER_FMT": failed to rename %s to %s.", + PKG_VER_PRINTF(ipkg->pkg), tmpname, name); + ipkg->broken_files = 1; + } } /* Claim ownership of the file in db */ |