elf-util: do not ignore prctl() errors

We want to avoid loops, so fail and return if we can't disable
core dumping

CID#1467004
This commit is contained in:
Luca Boccassi
2021-12-01 16:00:26 +00:00
committed by Luca Boccassi
parent a783421498
commit 541b127170
+5 -2
View File
@@ -604,8 +604,11 @@ int parse_elf_object(int fd, const char *executable, bool fork_disable_dump, cha
}
if (r == 0) {
/* We want to avoid loops, given this can be called from systemd-coredump */
if (fork_disable_dump)
prctl(PR_SET_DUMPABLE, 0);
if (fork_disable_dump) {
r = RET_NERRNO(prctl(PR_SET_DUMPABLE, 0));
if (r < 0)
goto child_fail;
}
r = parse_core(fd, executable, ret ? &buf : NULL, ret_package_metadata ? &package_metadata : NULL);
if (r < 0)