explain_lchmod_or_die(3)

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

πŸ’– NAME πŸ’–

explain_lchmod_or_die β€” bestie, we're changing the permissions of a file and reporting errors like a whole main character. No silent failures in this house, periodt. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/lchmod.h>
void explain_lchmod_or_die(const char *pathname, mode_t mode);
int explain_lchmod_on_error(const char *pathname, mode_t mode);

Like, two whole functions?? We love options. 🫢


🌸 DESCRIPTION 🌸

okay so, first up: explain_lchmod_or_die is the function you call when you want to call the lchmod(2) system call. And if it fails? Not just a little whisper of an error, no. An explanation gets printed to stderr, obtained from the explain_lchmod(3) function, and then β€” and this is the dramatic part β€” the process terminates by calling exit(EXIT_FAILURE). it's giving no second chances. πŸ’€

Then there's explain_lchmod_on_error, which is the chill one. It also calls the lchmod(2) system call, and on failure it also prints an explanation to stderr obtained from explain_lchmod(3) β€” but it still returns to the caller. So you get the tea without the funeral. πŸ¦‹

✨ the arguments ✨

  • pathname β€” the pathname, exactly as to be passed to the lchmod(2) system call. like, don't get cute with it, hand it over as-is. πŸ’…
  • mode β€” the mode, exactly as to be passed to the lchmod(2) system call. same energy, same rule. πŸŽ€

⭐ RETURN VALUE ⭐

explain_lchmod_or_die only returns on success, see lchmod(2) for more information. On failure, it prints an explanation and exits β€” it does not return. it's not coming back, bestie. it said what it said. 😭

explain_lchmod_on_error always returns the value return by the wrapped lchmod(2) system call. (yes, "return by", that's what the page says, i'm not editing the ancestors. πŸ™ˆ)


🌈 EXAMPLE 🌈

The explain_lchmod_or_die function is intended to be used in a fashion similar to the following example:

explain_lchmod_or_die(pathname, mode);

that's it. that's the whole vibe. iconic honestly. πŸ‘‘


🧚 SEE ALSO 🧚


libexplain version 1.4 Copyright (C) 2012 Peter Miller

and that's the whole page, bestie πŸ“ β€” brought to you by libexplain version 1.4, copyright (C) 2012 Peter Miller, and this lil manual entry for explain_lchmod_or_die(3) from the Library Functions Manual. go forth and chmod responsibly. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from