+ /* Check file size */
+ err = lstat(local_filename, &pkg_stat);
+
+ if (err) {
+ opkg_msg(ERROR, "Failed to stat %s: %s\n",
+ local_filename, strerror(errno));
+ return -1;
+ }
+
+ if (pkg_stat.st_size != pkg_get_int(pkg, PKG_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));
+ return -1;
+ } else {
+ opkg_msg(NOTICE,
+ "Ignored %s size mismatch.\n",
+ pkg->name);
+ }
+ }
+