diff options
| author | Jo-Philipp Wich | 2019-01-31 09:13:10 +0000 |
|---|---|---|
| committer | Jo-Philipp Wich | 2019-01-31 09:17:16 +0000 |
| commit | d4ba162bb3f931bd5a019154270a548cf1f0853b (patch) | |
| tree | e16d9f594065ecf687c82e4481e191457b14fb8b | |
| parent | cb6640381808dd629cfa58a21ceaf12e91a82e68 (diff) | |
| download | opkg-lede-d4ba162bb3f931bd5a019154270a548cf1f0853b.tar.gz | |
libopkg: only perform size check when information is available
Fixes: cb66403 ("libopkg: check for file size mismatches")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
| -rw-r--r-- | libopkg/opkg_install.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c index 0b7f1f1..976f446 100644 --- a/libopkg/opkg_install.c +++ b/libopkg/opkg_install.c @@ -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) { opkg_msg(ERROR, "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 { opkg_msg(NOTICE, |