summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
923f73d)
char *md5sum;
char *filename = conffile->name;
char *root_filename;
char *md5sum;
char *filename = conffile->name;
char *root_filename;
if (conffile->value == NULL) {
opkg_message(conf, OPKG_NOTICE, "%s: conffile %s has no md5sum\n", __FUNCTION__, conffile->name);
if (conffile->value == NULL) {
opkg_message(conf, OPKG_NOTICE, "%s: conffile %s has no md5sum\n", __FUNCTION__, conffile->name);
md5sum = file_md5sum_alloc(root_filename);
md5sum = file_md5sum_alloc(root_filename);
- ret = strcmp(md5sum, conffile->value);
- if (ret) {
+ if (md5sum && (ret = strcmp(md5sum, conffile->value))) {
opkg_message(conf, OPKG_NOTICE, "%s: conffile %s: \t\nold md5=%s \t\nnew md5=%s\n", __FUNCTION__,
conffile->name, md5sum, conffile->value);
}
free(root_filename);
opkg_message(conf, OPKG_NOTICE, "%s: conffile %s: \t\nold md5=%s \t\nnew md5=%s\n", __FUNCTION__,
conffile->name, md5sum, conffile->value);
}
free(root_filename);
+ if (md5sum)
+ free(md5sum);
strcat(line, buf);
} else {
line_size = buf_len + 1;
strcat(line, buf);
} else {
line_size = buf_len + 1;
}
if (buf[buf_len - 1] == '\n') {
break;
}
if (buf[buf_len - 1] == '\n') {
break;
md5sum_hex = calloc(1, md5sum_hex_len + 1);
if (md5sum_hex == NULL) {
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
md5sum_hex = calloc(1, md5sum_hex_len + 1);
if (md5sum_hex == NULL) {
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
}
file = fopen(file_name, "r");
if (file == NULL) {
fprintf(stderr, "%s: Failed to open file %s: %s\n",
__FUNCTION__, file_name, strerror(errno));
}
file = fopen(file_name, "r");
if (file == NULL) {
fprintf(stderr, "%s: Failed to open file %s: %s\n",
__FUNCTION__, file_name, strerror(errno));
+ free(md5sum_hex);
+ return NULL;
}
err = md5_stream(file, md5sum_bin);
if (err) {
fprintf(stderr, "%s: ERROR computing md5sum for %s: %s\n",
__FUNCTION__, file_name, strerror(err));
}
err = md5_stream(file, md5sum_bin);
if (err) {
fprintf(stderr, "%s: ERROR computing md5sum for %s: %s\n",
__FUNCTION__, file_name, strerror(err));
+ fclose(file);
+ free(md5sum_hex);
+ return NULL;
sha256sum_hex = calloc(1, sha256sum_hex_len + 1);
if (sha256sum_hex == NULL) {
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
sha256sum_hex = calloc(1, sha256sum_hex_len + 1);
if (sha256sum_hex == NULL) {
fprintf(stderr, "%s: out of memory\n", __FUNCTION__);
}
file = fopen(file_name, "r");
if (file == NULL) {
fprintf(stderr, "%s: Failed to open file %s: %s\n",
__FUNCTION__, file_name, strerror(errno));
}
file = fopen(file_name, "r");
if (file == NULL) {
fprintf(stderr, "%s: Failed to open file %s: %s\n",
__FUNCTION__, file_name, strerror(errno));
+ free(sha256sum_hex);
+ return NULL;
}
err = sha256_stream(file, sha256sum_bin);
if (err) {
fprintf(stderr, "%s: ERROR computing sha256sum for %s: %s\n",
__FUNCTION__, file_name, strerror(err));
}
err = sha256_stream(file, sha256sum_bin);
if (err) {
fprintf(stderr, "%s: ERROR computing sha256sum for %s: %s\n",
__FUNCTION__, file_name, strerror(err));
+ fclose(file);
+ free(sha256sum_hex);
+ return NULL;
for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
conffile_t *cf = (conffile_t *)iter->data;
int modified = conffile_has_been_modified(conf, cf);
for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
conffile_t *cf = (conffile_t *)iter->data;
int modified = conffile_has_been_modified(conf, cf);
- opkg_message(conf, OPKG_NOTICE, "conffile=%s md5sum=%s modified=%d\n",
+ if (cf->value)
+ opkg_message(conf, OPKG_NOTICE,
+ "conffile=%s md5sum=%s modified=%d\n",
cf->name, cf->value, modified);
}
}
cf->name, cf->value, modified);
}
}
if (pkg->md5sum)
{
file_md5 = file_md5sum_alloc(pkg->local_filename);
if (pkg->md5sum)
{
file_md5 = file_md5sum_alloc(pkg->local_filename);
- if (strcmp(file_md5, pkg->md5sum))
+ if (file_md5 && strcmp(file_md5, pkg->md5sum))
{
opkg_message(conf, OPKG_ERROR,
"Package %s md5sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
{
opkg_message(conf, OPKG_ERROR,
"Package %s md5sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
free(file_md5);
return OPKG_INSTALL_ERR_MD5;
}
free(file_md5);
return OPKG_INSTALL_ERR_MD5;
}
+ if (file_md5)
+ free(file_md5);
if(pkg->sha256sum)
{
file_sha256 = file_sha256sum_alloc(pkg->local_filename);
if(pkg->sha256sum)
{
file_sha256 = file_sha256sum_alloc(pkg->local_filename);
- if (strcmp(file_sha256, pkg->sha256sum))
+ if (file_sha256 && strcmp(file_sha256, pkg->sha256sum))
{
opkg_message(conf, OPKG_ERROR,
"Package %s sha256sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
{
opkg_message(conf, OPKG_ERROR,
"Package %s sha256sum mismatch. Either the opkg or the package index are corrupt. Try 'opkg update'.\n",
free(file_sha256);
return OPKG_INSTALL_ERR_SHA256;
}
free(file_sha256);
return OPKG_INSTALL_ERR_SHA256;
}
+ if (file_sha256)
+ free(file_sha256);
conffile_list_elt_t *iter;
conffile_t *cf;
char *cf_backup;
conffile_list_elt_t *iter;
conffile_t *cf;
char *cf_backup;
if (conf->noaction) return 0;
for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
if (conf->noaction) return 0;
for (iter = nv_pair_list_first(&pkg->conffiles); iter; iter = nv_pair_list_next(&pkg->conffiles, iter)) {
if (file_exists(cf_backup)) {
/* Let's compute md5 to test if files are changed */
md5sum = file_md5sum_alloc(cf_backup);
if (file_exists(cf_backup)) {
/* Let's compute md5 to test if files are changed */
md5sum = file_md5sum_alloc(cf_backup);
- if (strcmp( cf->value,md5sum) != 0 ) {
+ if (md5sum && cf->value && strcmp(cf->value,md5sum) != 0 ) {
if (conf->force_maintainer) {
opkg_message(conf, OPKG_NOTICE, "Conffile %s using maintainer's setting.\n", cf_backup);
} else if (conf->force_defaults
if (conf->force_maintainer) {
opkg_message(conf, OPKG_NOTICE, "Conffile %s using maintainer's setting.\n", cf_backup);
} else if (conf->force_defaults
+ if (md5sum)
+ free(md5sum);