EXPLAIN_SETRESUID_OR_DIE(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– 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 β€” the ruid, exactly as to be passed to the setresuid(2) system call. (yes, exactly. don't get cute with it.)
  • euid β€” the euid, exactly as to be passed to the setresuid(2) system call.
  • suid β€” the suid, exactly as to be passed to the setresuid(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 πŸ’«

iykyk, go read them. πŸ‘‘


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