EXPLAIN_SETRESUID_OR_DIE(3)
π explain_setresuid_or_die(3) β the manual, but make it make sense π
okay bestie, sit down, hydrate, because we're talking about explain_setresuid_or_die(3) β a Library Functions Manual moment from the libexplain girlies. it's giving "I call setresuid(2) and I will tell you exactly what went wrong." β¨
πΈ NAME πΈ
explain_setresuid_or_die β set r/e/s user ID and report errors π«Ά
like. that's the whole gig. you set the real, effective and saved user IDs, and if it flops, this function is NOT going to be quiet about it. π
β¨ SYNOPSIS β¨
#include <libexplain/setresuid.h>
void explain_setresuid_or_die(uid_t ruid, uid_t euid, uid_t suid);
int explain_setresuid_on_error(uid_t ruid, uid_t euid, uid_t suid);
two functions, one header, zero chill. π
π¦ DESCRIPTION π¦
explain_setresuid_or_die π
this one is used to call the setresuid(2) system call. and bestie, if it fails? an explanation gets printed to stderr, obtained from the explain_setresuid(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
so like. it doesn't come back. it exits. main character exit. π
explain_setresuid_on_error π
same energy, softer landing: also used to call the setresuid(2) system call, and on failure an explanation gets printed to stderr, obtained from the explain_setresuid(3) function β but this one still returns to the caller. no dramatic exit. it's the chill sibling. π§
the args, periodt π
ruidβ theruid, exactly as to be passed to thesetresuid(2)system call. (yes, exactly. don't get cute with it.)euidβ theeuid, exactly as to be passed to thesetresuid(2)system call.suidβ thesuid, exactly as to be passed to thesetresuid(2)system call.
β RETURN VALUE β
explain_setresuid_or_die only returns on success β peep setresuid(2) for more info on that. on failure, it prints an explanation and exits, and it does not return. not even a little. π
explain_setresuid_on_error always returns the value returned by the wrapped setresuid(2) system call. always. fr fr. π
π EXAMPLE π
the explain_setresuid_or_die function is intended to be used in a fashion similar to the following example:
explain_setresuid_or_die(ruid, euid, suid);
that's it. that's the whole vibe. slay. π₯
π« SEE ALSO π«
setresuid(2)β set real, effective and saved user IDexplain_setresuid(3)β explainsetresuid(2)errorsexit(2)β terminate the calling process
iykyk, go read them. π
π COPYRIGHT π
okay so legally I have to say this and I'm saying it with love: this is libexplain version 1.4, and it's Copyright (C) 2012 Peter Miller. π«Ά
and that's the whole page, bestie β libexplain version 1.4, Copyright (C) 2012 Peter Miller, signing off like the icon it is. go set some user IDs responsibly π
β¨
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2012 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms