Skip to content

Commit

Permalink
binfmt/libelf: Fix return code
Browse files Browse the repository at this point in the history
Fix return code in case of error in loading constructor and destructor section.

Detected by Codesonar 54667871, 54667873
  • Loading branch information
SPRESENSE authored and xiaoxiang781216 committed Oct 11, 2024
1 parent 0b98e9e commit 801805d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion binfmt/libelf/libelf_ctors.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
*/

binfo("elf_findsection .ctors section failed: %d\n", ctoridx);
return ret == -ENOENT ? OK : ret;
return ctoridx == -ENOENT ? OK : ctoridx;
}

/* Now we can get a pointer to the .ctor section in the section header
Expand Down
2 changes: 1 addition & 1 deletion binfmt/libelf/libelf_dtors.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
*/

binfo("elf_findsection .dtors section failed: %d\n", dtoridx);
return ret == -ENOENT ? OK : ret;
return dtoridx == -ENOENT ? OK : dtoridx;
}

/* Now we can get a pointer to the .dtor section in the section header
Expand Down

0 comments on commit 801805d

Please sign in to comment.