Commit d4ba162b authored by Jo-Philipp Wich's avatar Jo-Philipp Wich
Browse files

libopkg: only perform size check when information is available

Fixes: cb664038

 ("libopkg: check for file size mismatches")
Signed-off-by: default avatarJo-Philipp Wich <>
parent cb664038
......@@ -1255,6 +1255,7 @@ int opkg_install_pkg(pkg_t * pkg, int from_upgrade)
char *file_sha256, *pkg_sha256;
sigset_t newset, oldset;
const char *local_filename;
long long int pkg_expected_size;
struct stat pkg_stat;
time_t now;
......@@ -1376,12 +1377,13 @@ int opkg_install_pkg(pkg_t * pkg, int from_upgrade)
return -1;
if (pkg_stat.st_size != pkg_get_int(pkg, PKG_SIZE)) {
pkg_expected_size = pkg_get_int(pkg, PKG_SIZE);
if (pkg_expected_size > 0 && pkg_stat.st_size != pkg_expected_size) {
if (!conf->force_checksum) {
"Package size mismatch: %s is %lld bytes, expecting %lld bytes\n",
pkg->name, (long long int)pkg_stat.st_size,
(long long int)pkg_get_int(pkg, PKG_SIZE));
pkg->name, (long long int)pkg_stat.st_size, pkg_expected_size);
return -1;
} else {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment