explain_lchmod_or_die(3)
π 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 thelchmod(2)system call. like, don't get cute with it, hand it over as-is. πmodeβ the mode, exactly as to be passed to thelchmod(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 π§
lchmod(2)β change permissions of a fileexplain_lchmod(3)β explainlchmod(2)errorsexit(2)β terminate the calling process
π COPYRIGHT π
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
- 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