util-lib: wrap personality() to fix up broken glibc error handling (#6766)
glibc appears to propagate different errors in different ways, let's fix this up, so that our own code doesn't get confused by this. See #6752 + #6737 for details. Fixes: #6755
This commit is contained in:
committed by
Evgeny Vereshchagin
parent
5463fa0a88
commit
21022b9dde
+5
-3
@@ -2614,11 +2614,13 @@ static int exec_child(
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if (context->personality != PERSONALITY_INVALID)
|
||||
if (personality(context->personality) < 0) {
|
||||
if (context->personality != PERSONALITY_INVALID) {
|
||||
r = safe_personality(context->personality);
|
||||
if (r < 0) {
|
||||
*exit_status = EXIT_PERSONALITY;
|
||||
return -errno;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
if (context->utmp_id)
|
||||
utmp_put_init_process(context->utmp_id, getpid_cached(), getsid(0),
|
||||
|
||||
Reference in New Issue
Block a user