sysupgrade-helper : Fix warnings during compilation

This change will fix warnings occurred during
compilation of sysupgrade source files

Change-Id: I0526da607b383064b4c5cea7462fe4c12c669a3b
Signed-off-by: Vijay Balaji <quic_vijbal@quicinc.com>
(cherry picked from commit 6a7c18c463)
This commit is contained in:
Vijay Balaji 2023-09-06 10:38:11 +05:30
parent 5f169ad23b
commit 04a18622dd
2 changed files with 12 additions and 6 deletions

View file

@ -794,7 +794,7 @@ int get_ubi_volume_id(char *vol_name)
fgets(ubi_vol_name, sizeof(ubi_vol_name), fp);
if (strstr(ubi_vol_name, vol_name)) {
printf("%s volume id = %d\n", vol_name, i);
close(fp);
fclose(fp);
return i;
}
}
@ -811,10 +811,11 @@ int get_ubi_volume_id(char *vol_name)
* to get the ELF header of rootfs metadata.
*/
void extract_binary(struct image_section *section)
int extract_binary(struct image_section *section)
{
extract_kernel_binary(section, "kernel");
parse_elf_image_phdr(section);
return 1;
}
/**
@ -1013,7 +1014,7 @@ int extract_rootfs_binary(char *filename)
fp = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, ifd, 0);
if (fp == MAP_FAILED) {
perror("mmap");
close(fp);
close(ifd);
return 0;
}
@ -1049,13 +1050,16 @@ int compute_sha_hash(struct image_section *section)
int retval;
#ifdef USE_SHA384
snprintf(command, sizeof(command),
retval = snprintf(command, sizeof(command),
"openssl dgst -sha384 -binary -out %s %s", sha_hash, section->tmp_file);
#endif
#ifdef USE_SHA256
snprintf(command, sizeof(command),
retval = snprintf(command, sizeof(command),
"openssl dgst -sha256 -binary -out %s %s", sha_hash, section->tmp_file);
#endif
if (retval < 0) {
return retval;
}
retval = system(command);
if (retval != 0) {
printf("Error generating sha-hash, command : %s\n",command);

View file

@ -113,8 +113,10 @@ int is_version_check_enabled(void);
int get_sw_id_from_component_bin(struct image_section *);
int get_sw_id_from_component_bin_elf(struct image_section *);
int get_sw_id_from_component_bin_elf64(struct image_section *);
void extract_binary(struct image_section *);
int extract_binary(struct image_section *);
int extract_kernel_binary(struct image_section *, char *);
int extract_ubi_volume(char *, char *, char *);
int extract_rootfs_binary(char *);
int is_image_version_higher(void);
int update_version(void);
int check_image_version(void);