Skip to content

Commit 5e81726

Browse files
SPRESENSExiaoxiang781216
authored andcommitted
binfmt/libelf: Fix return code
Fix return code in case of error in loading constructor and destructor section. Detected by Codesonar 54667871, 54667873
1 parent 1816d75 commit 5e81726

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

binfmt/libelf/libelf_ctors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int elf_loadctors(FAR struct elf_loadinfo_s *loadinfo)
9999
*/
100100

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

105105
/* Now we can get a pointer to the .ctor section in the section header

binfmt/libelf/libelf_dtors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int elf_loaddtors(FAR struct elf_loadinfo_s *loadinfo)
100100
*/
101101

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

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

0 commit comments

Comments
 (0)